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

Side by Side Diff: chrome/test/data/extensions/api_test/uncaught_exception_logging/test.js

Issue 2116563003: [DevTools] Report unhandled exceptions and promise rejections through Runtime. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after ExceptionDetails change Created 4 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 | third_party/WebKit/LayoutTests/inspector-protocol/console/exception-from-worker-contains-stack.html » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 function createTestFunction(expected_message) { 5 function createTestFunction(expected_message) {
6 return function(tab) { 6 return function(tab) {
7 function onDebuggerEvent(debuggee, method, params) { 7 function onDebuggerEvent(debuggee, method, params) {
8 if (debuggee.tabId == tab.id && method == 'Console.messageAdded') { 8 if (debuggee.tabId == tab.id && method == 'Runtime.exceptionThrown') {
9 if (params.message.text.indexOf(expected_message) > -1) { 9 if (params.details.text.indexOf(expected_message) > -1) {
10 chrome.debugger.onEvent.removeListener(onDebuggerEvent); 10 chrome.debugger.onEvent.removeListener(onDebuggerEvent);
11 chrome.test.succeed(); 11 chrome.test.succeed();
12 } 12 }
13 } 13 }
14 }; 14 };
15 chrome.debugger.onEvent.addListener(onDebuggerEvent); 15 chrome.debugger.onEvent.addListener(onDebuggerEvent);
16 chrome.debugger.attach({ tabId: tab.id }, "1.1", function() { 16 chrome.debugger.attach({ tabId: tab.id }, "1.1", function() {
17 // Enabling console provides both stored and new messages via the 17 // Enabling console provides both stored and new messages via the
18 // Console.messageAdded event. 18 // Console.messageAdded event.
19 chrome.debugger.sendCommand({ tabId: tab.id }, "Console.enable"); 19 chrome.debugger.sendCommand({ tabId: tab.id }, "Runtime.enable");
20 }); 20 });
21 } 21 }
22 } 22 }
23 23
24 chrome.test.runTests([ 24 chrome.test.runTests([
25 function testExceptionInExtensionPage() { 25 function testExceptionInExtensionPage() {
26 chrome.tabs.create( 26 chrome.tabs.create(
27 {url: chrome.runtime.getURL('extension_page.html')}, 27 {url: chrome.runtime.getURL('extension_page.html')},
28 createTestFunction('Exception thrown in extension page.')); 28 createTestFunction('Exception thrown in extension page.'));
29 }, 29 },
(...skipping 10 matching lines...) Expand all
40 40
41 chrome.test.getConfig(function(config) { 41 chrome.test.getConfig(function(config) {
42 var test_url = 42 var test_url =
43 'http://localhost:PORT/extensions/test_file.html' 43 'http://localhost:PORT/extensions/test_file.html'
44 .replace(/PORT/, config.testServer.port); 44 .replace(/PORT/, config.testServer.port);
45 45
46 chrome.tabs.create({ url: test_url }, injectScriptAndSendMessage); 46 chrome.tabs.create({ url: test_url }, injectScriptAndSendMessage);
47 }); 47 });
48 } 48 }
49 ]); 49 ]);
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector-protocol/console/exception-from-worker-contains-stack.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698