| 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" | 6 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h" |
| 7 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | 7 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
| 8 #include "chrome/test/base/testing_profile.h" | 8 #include "chrome/test/base/testing_profile.h" |
| 9 #include "chromeos/network/mock_network_device_handler.h" | 9 #include "chromeos/network/mock_network_device_handler.h" |
| 10 #include "content/public/test/test_browser_thread_bundle.h" | 10 #include "content/public/test/test_browser_thread_bundle.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 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); |
| 31 } | 31 } |
| 32 ~WakeOnWifiObserverTest() override {} | 32 ~WakeOnWifiObserverTest() override {} |
| 33 | 33 |
| 34 private: |
| 35 // Must outlive |profile_|. |
| 36 content::TestBrowserThreadBundle thread_bundle_; |
| 37 |
| 34 protected: | 38 protected: |
| 35 StrictMock<MockNetworkDeviceHandler> mock_network_device_handler_; | 39 StrictMock<MockNetworkDeviceHandler> mock_network_device_handler_; |
| 36 TestingProfile profile_; | 40 TestingProfile profile_; |
| 37 | 41 |
| 38 private: | 42 private: |
| 39 content::TestBrowserThreadBundle thread_bundle_; | |
| 40 | |
| 41 DISALLOW_COPY_AND_ASSIGN(WakeOnWifiObserverTest); | 43 DISALLOW_COPY_AND_ASSIGN(WakeOnWifiObserverTest); |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 } // namespace | 46 } // namespace |
| 45 | 47 |
| 46 TEST_F(WakeOnWifiObserverTest, TestWakeOnWifiPacketAdd) { | 48 TEST_F(WakeOnWifiObserverTest, TestWakeOnWifiPacketAdd) { |
| 47 WakeOnWifiConnectionObserver observer( | 49 WakeOnWifiConnectionObserver observer( |
| 48 &profile_, false, WakeOnWifiManager::WAKE_ON_WIFI_PACKET, | 50 &profile_, false, WakeOnWifiManager::WAKE_ON_WIFI_PACKET, |
| 49 &mock_network_device_handler_); | 51 &mock_network_device_handler_); |
| 50 | 52 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 &mock_network_device_handler_); | 87 &mock_network_device_handler_); |
| 86 | 88 |
| 87 EXPECT_CALL(mock_network_device_handler_, | 89 EXPECT_CALL(mock_network_device_handler_, |
| 88 RemoveWifiWakeOnPacketConnection(_, _, _)) | 90 RemoveWifiWakeOnPacketConnection(_, _, _)) |
| 89 .Times(0); | 91 .Times(0); |
| 90 | 92 |
| 91 observer.RemoveWakeOnPacketConnection(); | 93 observer.RemoveWakeOnPacketConnection(); |
| 92 } | 94 } |
| 93 | 95 |
| 94 } // namespace chromeos | 96 } // namespace chromeos |
| OLD | NEW |