OLD | NEW |
(Empty) | |
| 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 // Test that the id and items fields in FileEntry can be read. |
| 7 chrome.test.runTests([ |
| 8 function testUrlHandler() { |
| 9 chrome.test.assertTrue(typeof launchData != 'undefined', "No launchData"); |
| 10 chrome.test.assertEq(launchData.id, "my_doc_url", |
| 11 "launchData.id incorrect"); |
| 12 chrome.test.assertTrue(typeof launchData.items == 'undefined', |
| 13 "Launched for file_handlers, not url_handlers"); |
| 14 chrome.test.assertTrue(typeof launchData.url != 'undefined', |
| 15 "No url in launchData"); |
| 16 chrome.test.assertTrue(typeof launchData.referrerUrl != 'undefined', |
| 17 "No referrerUrl in launchData"); |
| 18 chrome.test.assertFalse( |
| 19 !launchData.url.match( |
| 20 /http:\/\/.*:.*\/extensions\/platform_apps\/url_handlers\/.*/), |
| 21 "Wrong launchData.url"); |
| 22 } |
| 23 ]); |
| 24 |
| 25 chrome.app.window.create( |
| 26 "main.html", |
| 27 { }, |
| 28 function(win) { |
| 29 win.contentWindow.onload = function() { |
| 30 var link = this.document.querySelector('#link'); |
| 31 link.href = launchData.url; |
| 32 link.innerText = launchData.url; |
| 33 chrome.test.sendMessage("Handler launched"); |
| 34 } |
| 35 }); |
| 36 }); |
OLD | NEW |