- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / data / extensions / platform_apps / web_view / common / main.js
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 var startTest = function(testDir) {
6   LOG('startTest: ' + testDir);
7   // load bootstrap script.
8   var script = document.createElement('script');
9   var scriptPath = testDir + '/bootstrap.js';
10   script.type = 'text/javascript';
11   script.src = scriptPath;
12   document.getElementsByTagName('head')[0].appendChild(script);
13
14   script.addEventListener('error', function(e) {
15     // This is mostly for debugging, e.g. if you specify an incorrect path
16     // for guest bootstrap.js script.
17     window.console.log('Error in loading guest script from path: ' +
18                        scriptPath +
19                        ', Possibly misspelled path?');
20     utils.test.fail();
21   });
22 };
23
24 var onloadFunction = function() {
25   window.console.log('app.onload');
26   chrome.test.getConfig(function(config) {
27     LOG('embeder.common got config: ' + config);
28     LOG('customArg: ' + config.customArg);
29     loadFired = true;
30     window['startTest'](config.customArg);
31   });
32 };
33
34 onload = onloadFunction;
35