Chromium Code Reviews| Index: chrome/browser/chromeos/tether/tether_service.cc |
| diff --git a/chrome/browser/chromeos/tether/tether_service.cc b/chrome/browser/chromeos/tether/tether_service.cc |
| index 173b014d99a2b8041ff8411d3ae4f4712ee5d2d2..c91e10a95694b747ecf70b69e40619e36c2776f9 100644 |
| --- a/chrome/browser/chromeos/tether/tether_service.cc |
| +++ b/chrome/browser/chromeos/tether/tether_service.cc |
| @@ -198,15 +198,24 @@ bool TetherService::HasSyncedTetherHosts() const { |
| } |
| void TetherService::UpdateTetherTechnologyState() { |
| - chromeos::NetworkStateHandler::TechnologyState tether_technology_state = |
| + bool was_tether_enabled = network_state_handler_->IsTechnologyEnabled( |
| + chromeos::NetworkTypePattern::Tether()); |
| + |
| + chromeos::NetworkStateHandler::TechnologyState new_tether_technology_state = |
| GetTetherTechnologyState(); |
| - network_state_handler_->SetTetherTechnologyState(tether_technology_state); |
| + network_state_handler_->SetTetherTechnologyState(new_tether_technology_state); |
| - if (tether_technology_state == |
| - chromeos::NetworkStateHandler::TechnologyState::TECHNOLOGY_ENABLED) { |
| + if (!was_tether_enabled && |
|
Ryan Hansberry
2017/06/26 23:55:08
Please add a test.
Kyle Horimoto
2017/06/27 00:56:01
Added tests. When testing, I realized that this is
|
| + new_tether_technology_state == |
| + chromeos::NetworkStateHandler::TechnologyState::TECHNOLOGY_ENABLED) { |
| + // Start if the feature is enabled and was not previously running. |
| StartTetherIfEnabled(); |
| - } else { |
| + } else if (was_tether_enabled && |
| + new_tether_technology_state != |
| + chromeos::NetworkStateHandler::TechnologyState:: |
| + TECHNOLOGY_ENABLED) { |
| + // Stop if the feature is not enabled and was previously running. |
| StopTether(); |
| } |
| } |