| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "chrome/browser/chromeos/net/network_throttling_observer.h" | 9 #include "chrome/browser/chromeos/net/network_throttling_observer.h" |
| 10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 std::unique_ptr<ShillManagerClient>(mock_manager_client_)); | 35 std::unique_ptr<ShillManagerClient>(mock_manager_client_)); |
| 36 network_state_handler_ = NetworkStateHandler::InitializeForTest(); | 36 network_state_handler_ = NetworkStateHandler::InitializeForTest(); |
| 37 NetworkHandler::Initialize(); | 37 NetworkHandler::Initialize(); |
| 38 local_state_ = base::MakeUnique<TestingPrefServiceSimple>(); | 38 local_state_ = base::MakeUnique<TestingPrefServiceSimple>(); |
| 39 local_state_->registry()->RegisterDictionaryPref( | 39 local_state_->registry()->RegisterDictionaryPref( |
| 40 prefs::kNetworkThrottlingEnabled); | 40 prefs::kNetworkThrottlingEnabled); |
| 41 observer_ = base::MakeUnique<NetworkThrottlingObserver>(local_state_.get()); | 41 observer_ = base::MakeUnique<NetworkThrottlingObserver>(local_state_.get()); |
| 42 } | 42 } |
| 43 | 43 |
| 44 ~NetworkThrottlingObserverTest() override { | 44 ~NetworkThrottlingObserverTest() override { |
| 45 network_state_handler_->Shutdown(); |
| 45 observer_.reset(); | 46 observer_.reset(); |
| 46 local_state_.reset(); | 47 local_state_.reset(); |
| 47 network_state_handler_.reset(); | 48 network_state_handler_.reset(); |
| 48 NetworkHandler::Shutdown(); | 49 NetworkHandler::Shutdown(); |
| 49 DBusThreadManager::Shutdown(); | 50 DBusThreadManager::Shutdown(); |
| 50 } | 51 } |
| 51 | 52 |
| 52 base::MessageLoop message_loop_; | 53 base::MessageLoop message_loop_; |
| 53 std::unique_ptr<NetworkStateHandler> network_state_handler_; | 54 std::unique_ptr<NetworkStateHandler> network_state_handler_; |
| 54 std::unique_ptr<TestingPrefServiceSimple> local_state_; | 55 std::unique_ptr<TestingPrefServiceSimple> local_state_; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 79 | 80 |
| 80 // Clearing the preference should disable throttling | 81 // Clearing the preference should disable throttling |
| 81 EXPECT_CALL(*mock_manager_client_, | 82 EXPECT_CALL(*mock_manager_client_, |
| 82 SetNetworkThrottlingStatus(false, 0, 0, _, _)) | 83 SetNetworkThrottlingStatus(false, 0, 0, _, _)) |
| 83 .Times(1); | 84 .Times(1); |
| 84 local_state_->ClearPref(prefs::kNetworkThrottlingEnabled); | 85 local_state_->ClearPref(prefs::kNetworkThrottlingEnabled); |
| 85 } | 86 } |
| 86 | 87 |
| 87 } // namespace test | 88 } // namespace test |
| 88 } // namespace chromeos | 89 } // namespace chromeos |
| OLD | NEW |