OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 if (!chrome || !chrome.test) | 5 if (!chrome || !chrome.test) |
6 throw new Error('chrome.test is undefined'); | 6 throw new Error('chrome.test is undefined'); |
7 | 7 |
8 var portNumber; | 8 var portNumber; |
9 | 9 |
10 // This is a good end-to-end test for two reasons. The first is obvious - it | 10 // This is a good end-to-end test for two reasons. The first is obvious - it |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 }); | 79 }); |
80 var url = 'http://localhost:' + portNumber + | 80 var url = 'http://localhost:' + portNumber + |
81 '/native_bindings/messaging_test.html'; | 81 '/native_bindings/messaging_test.html'; |
82 chrome.tabs.create({url: url}, function(tab) { | 82 chrome.tabs.create({url: url}, function(tab) { |
83 chrome.test.assertNoLastError(); | 83 chrome.test.assertNoLastError(); |
84 chrome.test.assertTrue(!!tab); | 84 chrome.test.assertTrue(!!tab); |
85 chrome.test.assertTrue(!!tab.id && tab.id >= 0); | 85 chrome.test.assertTrue(!!tab.id && tab.id >= 0); |
86 tabId = tab.id; | 86 tabId = tab.id; |
87 }); | 87 }); |
88 }, | 88 }, |
| 89 function testLastError() { |
| 90 chrome.runtime.setUninstallURL('chrome://newtab', function() { |
| 91 chrome.test.assertLastError('Invalid URL: "chrome://newtab".'); |
| 92 chrome.test.succeed(); |
| 93 }); |
| 94 }, |
89 ]; | 95 ]; |
90 | 96 |
91 chrome.test.getConfig(config => { | 97 chrome.test.getConfig(config => { |
92 chrome.test.assertTrue(!!config, 'config does not exist'); | 98 chrome.test.assertTrue(!!config, 'config does not exist'); |
93 chrome.test.assertTrue(!!config.testServer, 'testServer does not exist'); | 99 chrome.test.assertTrue(!!config.testServer, 'testServer does not exist'); |
94 portNumber = config.testServer.port; | 100 portNumber = config.testServer.port; |
95 chrome.test.runTests(tests); | 101 chrome.test.runTests(tests); |
96 }); | 102 }); |
OLD | NEW |