Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1231)

Side by Side Diff: chrome/test/data/extensions/api_test/native_bindings/extension/background.js

Issue 2953133002: [Extensions Bindings] Support chrome.extension.lastError (Closed)
Patch Set: jbroman's, lazyboy's Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | extensions/renderer/bindings/api_binding_js_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 chrome.test.assertEq('new title', results[0]); 117 chrome.test.assertEq('new title', results[0]);
118 chrome.tabs.get(tab.id, tab => { 118 chrome.tabs.get(tab.id, tab => {
119 chrome.test.assertEq('new title', tab.title); 119 chrome.test.assertEq('new title', tab.title);
120 chrome.test.succeed(); 120 chrome.test.succeed();
121 }); 121 });
122 }); 122 });
123 }); 123 });
124 }, 124 },
125 function testLastError() { 125 function testLastError() {
126 chrome.runtime.setUninstallURL('chrome://newtab', function() { 126 chrome.runtime.setUninstallURL('chrome://newtab', function() {
127 chrome.test.assertLastError('Invalid URL: "chrome://newtab".'); 127 var expectedError = 'Invalid URL: "chrome://newtab".';
128 chrome.test.assertLastError(expectedError);
129 // Explicitly also test the old extension.lastError property.
130 chrome.test.assertTrue(!!chrome.extension.lastError);
131 chrome.test.assertEq(expectedError, chrome.extension.lastError.message);
128 chrome.test.succeed(); 132 chrome.test.succeed();
129 }); 133 });
130 }, 134 },
131 function testStorage() { 135 function testStorage() {
132 // Check API existence; StorageArea functions. 136 // Check API existence; StorageArea functions.
133 chrome.test.assertTrue(!!chrome.storage); 137 chrome.test.assertTrue(!!chrome.storage);
134 chrome.test.assertTrue(!!chrome.storage.local, 'no local'); 138 chrome.test.assertTrue(!!chrome.storage.local, 'no local');
135 chrome.test.assertTrue(!!chrome.storage.local.set, 'no set'); 139 chrome.test.assertTrue(!!chrome.storage.local.set, 'no set');
136 chrome.test.assertTrue(!!chrome.storage.local.get, 'no get'); 140 chrome.test.assertTrue(!!chrome.storage.local.get, 'no get');
137 // Check some properties. 141 // Check some properties.
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 }); 325 });
322 }, 326 },
323 ]; 327 ];
324 328
325 chrome.test.getConfig(config => { 329 chrome.test.getConfig(config => {
326 chrome.test.assertTrue(!!config, 'config does not exist'); 330 chrome.test.assertTrue(!!config, 'config does not exist');
327 chrome.test.assertTrue(!!config.testServer, 'testServer does not exist'); 331 chrome.test.assertTrue(!!config.testServer, 'testServer does not exist');
328 portNumber = config.testServer.port; 332 portNumber = config.testServer.port;
329 chrome.test.runTests(tests); 333 chrome.test.runTests(tests);
330 }); 334 });
OLDNEW
« no previous file with comments | « no previous file | extensions/renderer/bindings/api_binding_js_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698