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

Side by Side Diff: chrome/test/data/devtools/target_list/background.js

Issue 24995003: DevTools: Extract target discovery and manipulation from DevToolsHttpHandlerImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed json/new handler Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 requestUrl(url, callback) { 5 function requestUrl(url, callback) {
6 var req = new XMLHttpRequest(); 6 var req = new XMLHttpRequest();
7 req.open('GET', url, true); 7 req.open('GET', url, true);
8 req.onload = function() { 8 req.onload = function() {
9 if (req.status == 200) 9 if (req.status == 200)
10 callback(req.responseText); 10 callback(req.responseText);
(...skipping 16 matching lines...) Expand all
27 27
28 var wsAddress = REMOTE_DEBUGGER_HOST + '/devtools/page/' + target.id; 28 var wsAddress = REMOTE_DEBUGGER_HOST + '/devtools/page/' + target.id;
29 29
30 chrome.test.assertEq( 30 chrome.test.assertEq(
31 '/devtools/devtools.html?ws=' + wsAddress, 31 '/devtools/devtools.html?ws=' + wsAddress,
32 target.devtoolsFrontendUrl); 32 target.devtoolsFrontendUrl);
33 // On some platforms (e.g. Chrome OS) target.faviconUrl might be empty for 33 // On some platforms (e.g. Chrome OS) target.faviconUrl might be empty for
34 // a freshly created tab. Ignore the check then. 34 // a freshly created tab. Ignore the check then.
35 if (target.faviconUrl) 35 if (target.faviconUrl)
36 chrome.test.assertEq(opt_faviconUrl, target.faviconUrl); 36 chrome.test.assertEq(opt_faviconUrl, target.faviconUrl);
37 chrome.test.assertEq('/thumb/' + target.id, target.thumbnailUrl); 37 // Sometimes thumbnailUrl is not available for a freshly loaded tab.
38 if (target.thumbnailUrl)
39 chrome.test.assertEq('/thumb/' + target.id, target.thumbnailUrl);
38 chrome.test.assertEq(opt_title || target.url, target.title); 40 chrome.test.assertEq(opt_title || target.url, target.title);
39 chrome.test.assertEq(type, target.type); 41 chrome.test.assertEq(type, target.type);
40 chrome.test.assertEq('ws://' + wsAddress, target.webSocketDebuggerUrl); 42 chrome.test.assertEq('ws://' + wsAddress, target.webSocketDebuggerUrl);
41 } 43 }
42 44
43 chrome.test.runTests([ 45 chrome.test.runTests([
44 function discoverTargets() { 46 function discoverTargets() {
45 var testPageUrl = chrome.extension.getURL('test_page.html'); 47 var testPageUrl = chrome.extension.getURL('test_page.html');
46 48
47 function onUpdated() { 49 function onUpdated() {
48 chrome.tabs.onUpdated.removeListener(onUpdated); 50 chrome.tabs.onUpdated.removeListener(onUpdated);
49 requestUrl('http://' + REMOTE_DEBUGGER_HOST + '/json', function(text) { 51 requestUrl('http://' + REMOTE_DEBUGGER_HOST + '/json', function(text) {
50 var targets = JSON.parse(text); 52 var targets = JSON.parse(text);
51 53
52 checkTarget(targets, 'about:blank', 'page'); 54 checkTarget(targets, 'about:blank', 'page');
53 checkTarget(targets, testPageUrl, 'page', 'Test page', 55 checkTarget(targets, testPageUrl, 'page', 'Test page',
54 chrome.extension.getURL('favicon.png')); 56 chrome.extension.getURL('favicon.png'));
55 checkTarget(targets, 57 checkTarget(targets,
56 chrome.extension.getURL('_generated_background_page.html'), 58 chrome.extension.getURL('_generated_background_page.html'),
57 'other'); 59 'other');
58 60
59 chrome.test.succeed(); 61 chrome.test.succeed();
60 }); 62 });
61 } 63 }
62 chrome.tabs.onUpdated.addListener(onUpdated); 64 chrome.tabs.onUpdated.addListener(onUpdated);
63 chrome.tabs.create({url: testPageUrl}); 65 chrome.tabs.create({url: testPageUrl});
64 } 66 }
65 ]); 67 ]);
OLDNEW
« no previous file with comments | « chrome/browser/devtools/browser_list_tabcontents_provider.cc ('k') | content/browser/devtools/devtools_http_handler_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698