| 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 #include "chrome/browser/chromeos/tether/tether_service.h" | 5 #include "chrome/browser/chromeos/tether/tether_service.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 private: | 226 private: |
| 227 DISALLOW_COPY_AND_ASSIGN(TetherServiceTest); | 227 DISALLOW_COPY_AND_ASSIGN(TetherServiceTest); |
| 228 }; | 228 }; |
| 229 | 229 |
| 230 TEST_F(TetherServiceTest, TestShutdown) { | 230 TEST_F(TetherServiceTest, TestShutdown) { |
| 231 CreateTetherService(); | 231 CreateTetherService(); |
| 232 EXPECT_TRUE(test_initializer_delegate_->is_tether_running()); | 232 EXPECT_TRUE(test_initializer_delegate_->is_tether_running()); |
| 233 | 233 |
| 234 ShutdownTetherService(); | 234 ShutdownTetherService(); |
| 235 | 235 |
| 236 EXPECT_EQ( | 236 // The TechnologyState should not have changed due to Shutdown() being called. |
| 237 chromeos::NetworkStateHandler::TechnologyState::TECHNOLOGY_UNAVAILABLE, | 237 // If it had changed, any settings UI that was previously open would have |
| 238 network_state_handler()->GetTechnologyState( | 238 // shown visual jank. |
| 239 chromeos::NetworkTypePattern::Tether())); | 239 EXPECT_EQ(chromeos::NetworkStateHandler::TechnologyState::TECHNOLOGY_ENABLED, |
| 240 network_state_handler()->GetTechnologyState( |
| 241 chromeos::NetworkTypePattern::Tether())); |
| 240 EXPECT_FALSE(test_initializer_delegate_->is_tether_running()); | 242 EXPECT_FALSE(test_initializer_delegate_->is_tether_running()); |
| 241 } | 243 } |
| 242 | 244 |
| 243 TEST_F(TetherServiceTest, TestSuspend) { | 245 TEST_F(TetherServiceTest, TestSuspend) { |
| 244 CreateTetherService(); | 246 CreateTetherService(); |
| 245 EXPECT_TRUE(test_initializer_delegate_->is_tether_running()); | 247 EXPECT_TRUE(test_initializer_delegate_->is_tether_running()); |
| 246 | 248 |
| 247 fake_power_manager_client_->SendSuspendImminent(); | 249 fake_power_manager_client_->SendSuspendImminent(); |
| 248 | 250 |
| 249 EXPECT_EQ( | 251 EXPECT_EQ( |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 tether_service_->updated_technology_state_count()); | 453 tether_service_->updated_technology_state_count()); |
| 452 | 454 |
| 453 SetTetherTechnologyStateEnabled(true); | 455 SetTetherTechnologyStateEnabled(true); |
| 454 SetTetherTechnologyStateEnabled(true); | 456 SetTetherTechnologyStateEnabled(true); |
| 455 SetTetherTechnologyStateEnabled(true); | 457 SetTetherTechnologyStateEnabled(true); |
| 456 | 458 |
| 457 updated_technology_state_count++; | 459 updated_technology_state_count++; |
| 458 EXPECT_EQ(updated_technology_state_count, | 460 EXPECT_EQ(updated_technology_state_count, |
| 459 tether_service_->updated_technology_state_count()); | 461 tether_service_->updated_technology_state_count()); |
| 460 } | 462 } |
| OLD | NEW |