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

Side by Side Diff: chrome/test/data/webui/inspect_ui_test.js

Issue 208013003: DevTools: Create end-to-end test for chrome://inspect (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed extension test Created 6 years, 9 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
« no previous file with comments | « chrome/browser/ui/webui/inspect_ui_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 function waitForElements(selector, populateFunctionName, callback) {
6 var elements = document.querySelectorAll(selector);
7 if (elements.length) {
8 callback(elements);
9 return;
10 }
11 var originalFunction = window[populateFunctionName];
12 expectNotEquals(undefined, originalFunction);
13 expectEquals(undefined, originalFunction.__isSniffer);
14 var interceptFunction = function() {
15 originalFunction.apply(window, arguments);
16 var elements = document.querySelectorAll(selector);
17 if (elements.length) {
18 window[populateFunctionName] = originalFunction;
19 callback(elements);
20 }
21 };
22 interceptFunction.__isSniffer = true;
23 window[populateFunctionName] = interceptFunction;
24 }
25
26 function findByContentSubstring(elements, content, childSelector) {
27 return Array.prototype.filter.call(elements, function(element) {
28 if (childSelector)
29 element = element.querySelector(childSelector);
30 return element && element.textContent.indexOf(content) >= 0;
31 })[0];
32 }
33
34 function testTargetListed(sectionSelector, populateFunctionName, url) {
35 waitForElements(
36 sectionSelector + ' .row',
37 populateFunctionName,
38 function(elements) {
39 var urlElement = findByContentSubstring(elements, url, '.url');
40 expectNotEquals(undefined, urlElement);
41 testDone();
42 });
43 }
44
45 function testAdbTargetsListed() {
46 waitForElements('.device', 'populateRemoteTargets', function(devices) {
47 expectEquals(2, devices.length);
48
49 var offlineDevice = findByContentSubstring(
50 devices, 'Offline', '.device-name');
51 expectNotEquals(undefined, offlineDevice);
52
53 var onlineDevice = findByContentSubstring(
54 devices, 'Nexus 6', '.device-name');
55 expectNotEquals(undefined, onlineDevice);
56
57 var browsers = onlineDevice.querySelectorAll('.browser');
58 expectEquals(4, browsers.length);
59
60 var chromeBrowser = findByContentSubstring(
61 browsers, 'Chrome (32.0.1679.0)', '.browser-name');
62 expectNotEquals(undefined, chromeBrowser);
63
64 var chromePages = chromeBrowser.querySelectorAll('.pages');
65 var chromiumPage = findByContentSubstring(
66 chromePages, 'http://www.chromium.org/', '.url');
67 expectNotEquals(undefined, chromiumPage);
68
69 var webView = findByContentSubstring(
70 browsers, 'WebView in com.sample.feed (4.0)', '.browser-name');
71 expectNotEquals(undefined, webView);
72
73 testDone();
74 });
75 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/inspect_ui_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698