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

Side by Side Diff: chromeos/network/network_connect_unittest.cc

Issue 2836543002: Revert of [CrOS Tether] Add the notion of a tether DeviceState. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « chromeos/network/managed_state.h ('k') | chromeos/network/network_connection_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "chromeos/network/network_connect.h" 5 #include "chromeos/network/network_connect.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 329
330 base::RunLoop().RunUntilIdle(); 330 base::RunLoop().RunUntilIdle();
331 331
332 NetworkConnect::Get()->SetTechnologyEnabled(NetworkTypePattern::Cellular(), 332 NetworkConnect::Get()->SetTechnologyEnabled(NetworkTypePattern::Cellular(),
333 true); 333 true);
334 } 334 }
335 335
336 TEST_F(NetworkConnectTest, ConnectToTetherNetwork) { 336 TEST_F(NetworkConnectTest, ConnectToTetherNetwork) {
337 EXPECT_CALL(*mock_tether_delegate_, ConnectToNetwork(kTether1Guid)); 337 EXPECT_CALL(*mock_tether_delegate_, ConnectToNetwork(kTether1Guid));
338 338
339 NetworkHandler::Get()->network_state_handler()->SetTetherTechnologyState(
340 NetworkStateHandler::TECHNOLOGY_ENABLED);
341
342 NetworkHandler::Get()->network_state_handler()->AddTetherNetworkState( 339 NetworkHandler::Get()->network_state_handler()->AddTetherNetworkState(
343 kTether1Guid, "TetherNetwork", "Carrier", 100 /* battery_percentage */, 340 kTether1Guid, "TetherNetwork", "Carrier", 100 /* battery_percentage */,
344 100 /* signal_strength */); 341 100 /* signal_strength */);
345 342
346 NetworkConnect::Get()->SetTetherDelegate(mock_tether_delegate_.get()); 343 NetworkConnect::Get()->SetTetherDelegate(mock_tether_delegate_.get());
347 NetworkConnect::Get()->ConnectToNetworkId(kTether1Guid); 344 NetworkConnect::Get()->ConnectToNetworkId(kTether1Guid);
348 } 345 }
349 346
350 TEST_F(NetworkConnectTest, ConnectToTetherNetwork_TetherNetworkDoesNotExist) { 347 TEST_F(NetworkConnectTest, ConnectToTetherNetwork_TetherNetworkDoesNotExist) {
351 EXPECT_CALL(*mock_tether_delegate_, ConnectToNetwork(_)).Times(0); 348 EXPECT_CALL(*mock_tether_delegate_, ConnectToNetwork(_)).Times(0);
352 349
353 NetworkHandler::Get()->network_state_handler()->SetTetherTechnologyState(
354 NetworkStateHandler::TECHNOLOGY_ENABLED);
355
356 NetworkConnect::Get()->SetTetherDelegate(mock_tether_delegate_.get()); 350 NetworkConnect::Get()->SetTetherDelegate(mock_tether_delegate_.get());
357 NetworkConnect::Get()->ConnectToNetworkId(kTether1Guid); 351 NetworkConnect::Get()->ConnectToNetworkId(kTether1Guid);
358 } 352 }
359 353
360 TEST_F(NetworkConnectTest, ConnectToTetherNetwork_TetherDelegateNotSet) { 354 TEST_F(NetworkConnectTest, ConnectToTetherNetwork_TetherDelegateNotSet) {
361 EXPECT_CALL(*mock_tether_delegate_, ConnectToNetwork(_)).Times(0); 355 EXPECT_CALL(*mock_tether_delegate_, ConnectToNetwork(_)).Times(0);
362 356
363 NetworkHandler::Get()->network_state_handler()->SetTetherTechnologyState(
364 NetworkStateHandler::TECHNOLOGY_ENABLED);
365
366 NetworkHandler::Get()->network_state_handler()->AddTetherNetworkState( 357 NetworkHandler::Get()->network_state_handler()->AddTetherNetworkState(
367 kTether1Guid, "TetherNetwork", "Carrier", 100 /* battery_percentage */, 358 kTether1Guid, "TetherNetwork", "Carrier", 100 /* battery_percentage */,
368 100 /* signal_strength */); 359 100 /* signal_strength */);
369 360
370 NetworkConnect::Get()->ConnectToNetworkId(kTether1Guid); 361 NetworkConnect::Get()->ConnectToNetworkId(kTether1Guid);
371 } 362 }
372 363
373 } // namespace chromeos 364 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/managed_state.h ('k') | chromeos/network/network_connection_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698