- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / data / extensions / platform_apps / url_handlers / handlers / navigate_webview_to_url / test.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 chrome.app.runtime.onLaunched.addListener(function (launchData) {
6   // Complete correctness of launchData is tested in another test.
7   chrome.test.assertTrue(typeof launchData !== 'undefined');
8
9   chrome.app.window.create(
10     "main.html",
11     {},
12     function(win) {
13       win.contentWindow.onload = function() {
14         // Redirect the embedded webview to the same URL we've been launched
15         // with. This should not create an endless loop of redirecting on
16         // ourselves with multiplying windows.
17         var webview = win.contentWindow.document.getElementById('wv');
18         webview.addEventListener("loadstop", function() {
19           // The webview has successfully navigated. That means that redirection
20           // didn't happen, as expected.
21           chrome.test.sendMessage("Handler launched");
22         });
23         webview.src = launchData.url;
24       }
25     }
26   );
27 });