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( | |
22 content::BrowserContext* context) { | |
23 return gcm::FakeGCMProfileService::Build(static_cast<Profile*>(context)); | |
24 } | |
25 | |
26 class WakeOnWifiObserverTest : public ::testing::Test { | 21 class WakeOnWifiObserverTest : public ::testing::Test { |
27 public: | 22 public: |
28 WakeOnWifiObserverTest() { | 23 WakeOnWifiObserverTest() { |
29 gcm::GCMProfileServiceFactory::GetInstance()->SetTestingFactory( | 24 gcm::GCMProfileServiceFactory::GetInstance()->SetTestingFactory( |
30 &profile_, &BuildFakeGCMProfileService); | 25 &profile_, &gcm::FakeGCMProfileService::Build); |
31 } | 26 } |
32 ~WakeOnWifiObserverTest() override {} | 27 ~WakeOnWifiObserverTest() override {} |
33 | 28 |
34 protected: | 29 protected: |
35 StrictMock<MockNetworkDeviceHandler> mock_network_device_handler_; | 30 StrictMock<MockNetworkDeviceHandler> mock_network_device_handler_; |
36 TestingProfile profile_; | 31 TestingProfile profile_; |
37 | 32 |
38 private: | 33 private: |
39 content::TestBrowserThreadBundle thread_bundle_; | 34 content::TestBrowserThreadBundle thread_bundle_; |
40 | 35 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 &mock_network_device_handler_); | 80 &mock_network_device_handler_); |
86 | 81 |
87 EXPECT_CALL(mock_network_device_handler_, | 82 EXPECT_CALL(mock_network_device_handler_, |
88 RemoveWifiWakeOnPacketConnection(_, _, _)) | 83 RemoveWifiWakeOnPacketConnection(_, _, _)) |
89 .Times(0); | 84 .Times(0); |
90 | 85 |
91 observer.RemoveWakeOnPacketConnection(); | 86 observer.RemoveWakeOnPacketConnection(); |
92 } | 87 } |
93 | 88 |
94 } // namespace chromeos | 89 } // namespace chromeos |
OLD | NEW |