B2G/gecko/netwerk/test/unit/test_pinned_app_cache.js
/*
 * Start caching app2 as a pinned app.
 *
 * This request use IP address (127.0.0.1) as the host name instead of
 * the one used by app1.  Because, app1 is also pinned when app2 is
 * pinned if they have the same host name (localhost).
 */
Start caching app2 as a pinned app.
This request use IP address (127.0.0.1) as the host name instead of
the one used by app1.  Because, app1 is also pinned when app2 is
pinned if they have the same host name (localhost).
Start caching app2 as a pinned app . This request use IP address ( 127 . 0 . 0 . 1 ) as the host name instead of the one used by app1 . Because app1 is also pinned when app2 is pinned if they have the same host name ( localhost ) .
function start_cache_pinned_app2_for_success() {
  let error_count = [0];
  do_print("Start pinned App2 for success\n");
  start_and_watch_app_cache(kHttpLocation_ip + "app2.appcache",
                            kHttpLocation_ip + "app2",
                            true,
                            function (update, state) {
                              switch(state) {
                              case STATE_FINISHED:
				do_check_true(error_count[0] == 0,
                                              "Do not discard app1?");
				httpServer.stop(do_test_finished);
				break;
                              case STATE_ERROR:
				do_print("STATE_ERROR\n");
				error_count[0]++;
				break;
                              }
                            },
                            function (appcahe) {
                              do_print("app2 avail " + appcache + "\n");
                            });
}
function start_cache_pinned_app2_for_success ( ) { let error_count = [ 0 ] ; do_print ( "Start pinned App2 for success\n" ) ; start_and_watch_app_cache ( kHttpLocation_ip + "app2.appcache" , kHttpLocation_ip + "app2" , true , function ( update , state ) { switch ( state ) { case STATE_FINISHED : do_check_true ( error_count [ 0 ] == 0 , "Do not discard app1?" ) ; httpServer . stop ( do_test_finished ) ; break ; case STATE_ERROR : do_print ( "STATE_ERROR\n" ) ; error_count [ 0 ] ++ ; break ; } } , function ( appcahe ) { do_print ( "app2 avail " + appcache + "\n" ) ; } ) ; }
Start caching app2 as a pinned app.
Start caching app2 as a pinned app .