| OLD | NEW |
| 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 Loading... |
| 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 type = filter.networkType; |
| 76 if (type == chrome.networkingPrivate.NetworkType.ALL) { |
| 77 callback(this.networkStates_.slice()); |
| 78 } else { |
| 79 callback(this.networkStates_.filter(function(state) { |
| 80 return state.Type == type; |
| 81 })); |
| 82 } |
| 76 }, | 83 }, |
| 77 | 84 |
| 78 /** @override */ | 85 /** @override */ |
| 79 getDeviceStates: function(callback) { | 86 getDeviceStates: function(callback) { |
| 80 var devices = []; | 87 var devices = []; |
| 81 Object.keys(this.deviceStates_).forEach(function(type) { | 88 Object.keys(this.deviceStates_).forEach(function(type) { |
| 82 var state = this.deviceStates_[type]; | 89 var state = this.deviceStates_[type]; |
| 83 if (state.State != '') | 90 if (state.State != '') |
| 84 devices.push(state); | 91 devices.push(state); |
| 85 }.bind(this)); | 92 }.bind(this)); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 154 |
| 148 /** @type {!FakeChromeEvent} */ | 155 /** @type {!FakeChromeEvent} */ |
| 149 onDeviceStateListChanged: new FakeChromeEvent(), | 156 onDeviceStateListChanged: new FakeChromeEvent(), |
| 150 | 157 |
| 151 /** @type {!FakeChromeEvent} */ | 158 /** @type {!FakeChromeEvent} */ |
| 152 onPortalDetectionCompleted: new FakeChromeEvent(), | 159 onPortalDetectionCompleted: new FakeChromeEvent(), |
| 153 }; | 160 }; |
| 154 | 161 |
| 155 return {FakeNetworkingPrivate: FakeNetworkingPrivate}; | 162 return {FakeNetworkingPrivate: FakeNetworkingPrivate}; |
| 156 }); | 163 }); |
| OLD | NEW |