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

Side by Side Diff: chrome/test/data/webui/settings/fake_networking_private.js

Issue 2720503006: MD Settings: Internet: Move network lists to a subpage (Closed)
Patch Set: Rebase Created 3 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 /** 5 /**
6 * @fileoverview Fake implementation of chrome.networkingPrivate for testing. 6 * @fileoverview Fake implementation of chrome.networkingPrivate for testing.
7 */ 7 */
8 cr.define('settings', function() { 8 cr.define('settings', function() {
9 /** 9 /**
10 * @constructor 10 * @constructor
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 setProperties: assertNotReached, 65 setProperties: assertNotReached,
66 66
67 /** @override */ 67 /** @override */
68 createNetwork: assertNotReached, 68 createNetwork: assertNotReached,
69 69
70 /** @override */ 70 /** @override */
71 forgetNetwork: assertNotReached, 71 forgetNetwork: assertNotReached,
72 72
73 /** @override */ 73 /** @override */
74 getNetworks: function(filter, callback) { 74 getNetworks: function(filter, callback) {
75 callback(this.networkStates_); 75 var states = [];
michaelpg 2017/03/01 23:27:59 opt nit: It's just a style thing, but this.network
stevenjb 2017/03/02 00:25:17 One of these days I'll learn these crazy Javascrip
76 var type = filter.networkType;
77 for (var i = 0; i < this.networkStates_.length; ++i) {
78 var state = this.networkStates_[i];
79 if (type == chrome.networkingPrivate.NetworkType.ALL ||
80 type == state.Type) {
81 states.push(state);
82 }
83 }
84 callback(states);
76 }, 85 },
77 86
78 /** @override */ 87 /** @override */
79 getDeviceStates: function(callback) { 88 getDeviceStates: function(callback) {
80 var devices = []; 89 var devices = [];
81 Object.keys(this.deviceStates_).forEach(function(type) { 90 Object.keys(this.deviceStates_).forEach(function(type) {
82 var state = this.deviceStates_[type]; 91 var state = this.deviceStates_[type];
83 if (state.State != '') 92 if (state.State != '')
84 devices.push(state); 93 devices.push(state);
85 }.bind(this)); 94 }.bind(this));
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 156
148 /** @type {!FakeChromeEvent} */ 157 /** @type {!FakeChromeEvent} */
149 onDeviceStateListChanged: new FakeChromeEvent(), 158 onDeviceStateListChanged: new FakeChromeEvent(),
150 159
151 /** @type {!FakeChromeEvent} */ 160 /** @type {!FakeChromeEvent} */
152 onPortalDetectionCompleted: new FakeChromeEvent(), 161 onPortalDetectionCompleted: new FakeChromeEvent(),
153 }; 162 };
154 163
155 return {FakeNetworkingPrivate: FakeNetworkingPrivate}; 164 return {FakeNetworkingPrivate: FakeNetworkingPrivate};
156 }); 165 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698