Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/net/wake_on_wifi_connection_observer.h" | 5 #include "chrome/browser/chromeos/net/wake_on_wifi_connection_observer.h" |
| 6 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h" | |
| 7 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | 6 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
| 8 #include "chrome/test/base/testing_profile.h" | 7 #include "chrome/test/base/testing_profile.h" |
| 9 #include "chromeos/network/mock_network_device_handler.h" | 8 #include "chromeos/network/mock_network_device_handler.h" |
| 9 #include "components/gcm_driver/fake_gcm_profile_service.h" | |
| 10 #include "content/public/test/test_browser_thread_bundle.h" | 10 #include "content/public/test/test_browser_thread_bundle.h" |
| 11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 using testing::_; | 14 using testing::_; |
| 15 using testing::Return; | 15 using testing::Return; |
| 16 using testing::StrictMock; | 16 using testing::StrictMock; |
| 17 | 17 |
| 18 namespace chromeos { | 18 namespace chromeos { |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 std::unique_ptr<KeyedService> BuildFakeGCMProfileService( | 21 std::unique_ptr<KeyedService> BuildFakeGCMProfileService( |
| 22 content::BrowserContext* context) { | 22 content::BrowserContext* context) { |
| 23 return gcm::FakeGCMProfileService::Build(static_cast<Profile*>(context)); | 23 return gcm::FakeGCMProfileService::Build(static_cast<Profile*>(context)); |
| 24 } | 24 } |
| 25 | 25 |
| 26 class WakeOnWifiObserverTest : public ::testing::Test { | 26 class WakeOnWifiObserverTest : public ::testing::Test { |
| 27 public: | 27 public: |
| 28 WakeOnWifiObserverTest() { | 28 WakeOnWifiObserverTest() { |
| 29 gcm::GCMProfileServiceFactory::GetInstance()->SetTestingFactory( | 29 gcm::GCMProfileServiceFactory::GetInstance()->SetTestingFactory( |
| 30 &profile_, &BuildFakeGCMProfileService); | 30 &profile_, &BuildFakeGCMProfileService); |
|
Peter Beverloo
2016/07/08 14:00:01
nit: not your change, but you could remove lines 2
| |
| 31 } | 31 } |
| 32 ~WakeOnWifiObserverTest() override {} | 32 ~WakeOnWifiObserverTest() override {} |
| 33 | 33 |
| 34 protected: | 34 protected: |
| 35 StrictMock<MockNetworkDeviceHandler> mock_network_device_handler_; | 35 StrictMock<MockNetworkDeviceHandler> mock_network_device_handler_; |
| 36 TestingProfile profile_; | 36 TestingProfile profile_; |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 content::TestBrowserThreadBundle thread_bundle_; | 39 content::TestBrowserThreadBundle thread_bundle_; |
| 40 | 40 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 &mock_network_device_handler_); | 85 &mock_network_device_handler_); |
| 86 | 86 |
| 87 EXPECT_CALL(mock_network_device_handler_, | 87 EXPECT_CALL(mock_network_device_handler_, |
| 88 RemoveWifiWakeOnPacketConnection(_, _, _)) | 88 RemoveWifiWakeOnPacketConnection(_, _, _)) |
| 89 .Times(0); | 89 .Times(0); |
| 90 | 90 |
| 91 observer.RemoveWakeOnPacketConnection(); | 91 observer.RemoveWakeOnPacketConnection(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace chromeos | 94 } // namespace chromeos |
| OLD | NEW |