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

Side by Side Diff: chrome/browser/devtools/device/webrtc/devtools_bridge_client_browsertest.js

Issue 1560583002: DevTools: remove experimental webrtc-based remote debugging device provider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more tests/gyp removals Created 4 years, 11 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
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 GEN('#include "chrome/browser/devtools/device/webrtc/' +
6 'devtools_bridge_client_browsertest.h"');
7
8 /**
9 * Test fixture for DevToolsBridgeClientBrowserTest.
10 * @constructor
11 * @extends {testing.Test}
12 */
13 function DevToolsBridgeClientBrowserTest() {}
14
15 var DEVICES_URL = "https://www.googleapis.com/clouddevices/v1/devices";
16
17 DevToolsBridgeClientBrowserTest.prototype = {
18 __proto__: testing.Test.prototype,
19
20 /** @override */
21 typedefCppFixture: 'DevToolsBridgeClientBrowserTest',
22
23 /** @override */
24 isAsync: true,
25
26 /** @override */
27 browsePreload: DUMMY_URL,
28
29 setUp: function() {
30 this.callbacksMock = mock(DevToolsBridgeClientBrowserTest.NativeCallbacks);
31 window.callbacks = this.callbacksMock.proxy();
32 },
33
34 /**
35 * Simulates user sign in. DevToolsBridgeClient creates
36 * background_worker only in this case.
37 */
38 signIn: function() {
39 chrome.send('signIn', []);
40 return new Promise(function(resolve) {
41 this.callbacksMock.expects(once()).workerLoaded().will(
42 callFunction(resolve));
43 }.bind(this));
44 },
45
46 /**
47 * Creates GCD device definition which could be recognized as a
48 * DevToolsBridge.
49 *
50 * @param {string} id GCD instance id.
51 * @param {string} displayName Display name.
52 */
53 createInstanceDef: function(id, displayName) {
54 return {
55 'kind': 'clouddevices#device',
56 'deviceKind': 'vendor',
57 'id': id,
58 'displayName': displayName,
59 'commandDefs': {
60 'base': {
61 '_iceExchange': {'kind': 'clouddevices#commandDef'},
62 '_renegotiate': {'kind': 'clouddevices#commandDef'},
63 '_startSession': {'kind': 'clouddevices#commandDef'},
64 }
65 },
66 };
67 }
68 };
69
70 /**
71 * Callbacks from native DevToolsBridgeClientBrowserTest.
72 * @constructor
73 */
74 DevToolsBridgeClientBrowserTest.NativeCallbacks = function() {}
75
76 DevToolsBridgeClientBrowserTest.NativeCallbacks.prototype = {
77 workerLoaded: function() {},
78 gcdApiRequest: function(id, body) {},
79 browserListUpdated: function(count) {},
80 };
81
82 TEST_F('DevToolsBridgeClientBrowserTest', 'testSetUpOnMainThread', function() {
83 testDone();
84 });
85
86 TEST_F('DevToolsBridgeClientBrowserTest', 'testSignIn', function() {
87 this.signIn().then(testDone);
88 });
89
90 TEST_F('DevToolsBridgeClientBrowserTest', 'testQueryBrowsers', function() {
91 this.signIn().then(function() {
92 chrome.send('queryDevices');
93 });
94 var savedArgs = new SaveMockArguments();
95 this.callbacksMock.expects(once()).gcdApiRequest(
96 savedArgs.match(ANYTHING), DEVICES_URL, '').will(
97 callFunctionWithSavedArgs(savedArgs, function(id) {
98 var response = {
99 'kind': 'clouddevices#devicesListResponse',
100 'devices': [
101 this.createInstanceDef(
102 'ab911465-83c7-e335-ea64-cb656868cbe0', 'Test 1'),
103 this.createInstanceDef(
104 'ab911465-83c7-e335-ea64-cb656868cbe1', 'Test 2'),
105 this.createInstanceDef(
106 'ab911465-83c7-e335-ea64-cb656868cbe2', 'Test 3'),
107 ],
108 };
109 chrome.send('gcdApiResponse', [id, response]);
110 }.bind(this)));
111
112 var browsersCount = 3;
113
114 this.callbacksMock.expects(once()).browserListUpdated(browsersCount).will(
115 callFunction(testDone));
116 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698