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

Side by Side Diff: chrome/browser/chromeos/tether/fake_tether_service.cc

Issue 2900903002: Create a FakeTetherService, which stubs out TetherService for development. (Closed)
Patch Set: Fix TetherService tests. Created 3 years, 7 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 2017 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 #include "chrome/browser/chromeos/tether/fake_tether_service.h"
6
7 constexpr char kTetherGuidPrefix[] = "tether-guid-";
8 constexpr char kTetherNamePrefix[] = "tether";
9 constexpr char kCarrier[] = "FakeCarrier";
10
11 FakeTetherService::FakeTetherService(
12 Profile* profile,
13 chromeos::PowerManagerClient* power_manager_client,
14 chromeos::SessionManagerClient* session_manager_client,
15 cryptauth::CryptAuthService* cryptauth_service,
16 chromeos::NetworkStateHandler* network_state_handler)
17 : TetherService(profile,
18 power_manager_client,
19 session_manager_client,
20 cryptauth_service,
21 network_state_handler) {}
22
23 void FakeTetherService::StartTetherIfEnabled() {
24 if (GetTetherTechnologyState() !=
25 chromeos::NetworkStateHandler::TechnologyState::TECHNOLOGY_ENABLED) {
26 return;
27 }
28
29 for (int i = 0; i < num_tether_networks_; ++i) {
30 network_state_handler()->AddTetherNetworkState(
31 kTetherGuidPrefix + std::to_string(i),
32 kTetherNamePrefix + std::to_string(i), kCarrier,
33 100 /* battery_percentage */, 100 /* signal_strength */,
34 false /* has_connected_to_host */);
35 }
36 }
37
38 void FakeTetherService::StopTether() {
39 for (int i = 0; i < num_tether_networks_; ++i) {
40 network_state_handler()->RemoveTetherNetworkState(kTetherGuidPrefix + i);
41 }
42 }
43
44 bool FakeTetherService::HasSyncedTetherHosts() const {
45 return true;
46 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/tether/fake_tether_service.h ('k') | chrome/browser/chromeos/tether/tether_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698