OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 10 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 WifiData::AccessPointDataSet data_out_; | 35 WifiData::AccessPointDataSet data_out_; |
36 | 36 |
37 private: | 37 private: |
38 bool GetAccessPointDataInternal(WifiData::AccessPointDataSet* data) { | 38 bool GetAccessPointDataInternal(WifiData::AccessPointDataSet* data) { |
39 ++calls_; | 39 ++calls_; |
40 *data = data_out_; | 40 *data = data_out_; |
41 return bool_return_; | 41 return bool_return_; |
42 } | 42 } |
43 }; | 43 }; |
44 | 44 |
45 class MockPollingPolicy : public PollingPolicyInterface { | 45 class MockPollingPolicy : public WifiPollingPolicy { |
46 public: | 46 public: |
47 MockPollingPolicy() { | 47 MockPollingPolicy() { |
48 ON_CALL(*this,PollingInterval()) | 48 ON_CALL(*this,PollingInterval()) |
49 .WillByDefault(Return(1)); | 49 .WillByDefault(Return(1)); |
50 ON_CALL(*this,NoWifiInterval()) | 50 ON_CALL(*this,NoWifiInterval()) |
51 .WillByDefault(Return(1)); | 51 .WillByDefault(Return(1)); |
52 } | 52 } |
53 | 53 |
54 MOCK_METHOD0(PollingInterval, int()); | 54 MOCK_METHOD0(PollingInterval, int()); |
55 MOCK_METHOD0(NoWifiInterval, int()); | 55 MOCK_METHOD0(NoWifiInterval, int()); |
(...skipping 24 matching lines...) Expand all Loading... |
80 public: | 80 public: |
81 WifiDataProviderCommonWithMock() | 81 WifiDataProviderCommonWithMock() |
82 : new_wlan_api_(new MockWlanApi), | 82 : new_wlan_api_(new MockWlanApi), |
83 new_polling_policy_(new MockPollingPolicy) {} | 83 new_polling_policy_(new MockPollingPolicy) {} |
84 | 84 |
85 // WifiDataProviderCommon | 85 // WifiDataProviderCommon |
86 virtual WlanApiInterface* NewWlanApi() OVERRIDE { | 86 virtual WlanApiInterface* NewWlanApi() OVERRIDE { |
87 CHECK(new_wlan_api_ != NULL); | 87 CHECK(new_wlan_api_ != NULL); |
88 return new_wlan_api_.release(); | 88 return new_wlan_api_.release(); |
89 } | 89 } |
90 virtual PollingPolicyInterface* NewPollingPolicy() OVERRIDE { | 90 virtual WifiPollingPolicy* NewPollingPolicy() OVERRIDE { |
91 CHECK(new_polling_policy_ != NULL); | 91 CHECK(new_polling_policy_ != NULL); |
92 return new_polling_policy_.release(); | 92 return new_polling_policy_.release(); |
93 } | 93 } |
94 | 94 |
95 scoped_ptr<MockWlanApi> new_wlan_api_; | 95 scoped_ptr<MockWlanApi> new_wlan_api_; |
96 scoped_ptr<MockPollingPolicy> new_polling_policy_; | 96 scoped_ptr<MockPollingPolicy> new_polling_policy_; |
97 | 97 |
98 private: | 98 private: |
99 virtual ~WifiDataProviderCommonWithMock() {} | 99 virtual ~WifiDataProviderCommonWithMock() {} |
100 | 100 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 TEST_F(GeolocationWifiDataProviderCommonTest, RegisterUnregister) { | 219 TEST_F(GeolocationWifiDataProviderCommonTest, RegisterUnregister) { |
220 MessageLoopQuitter loop_quitter(&main_message_loop_); | 220 MessageLoopQuitter loop_quitter(&main_message_loop_); |
221 WifiDataProvider::SetFactory(CreateWifiDataProviderCommonWithMock); | 221 WifiDataProvider::SetFactory(CreateWifiDataProviderCommonWithMock); |
222 WifiDataProvider::Register(&loop_quitter.callback_); | 222 WifiDataProvider::Register(&loop_quitter.callback_); |
223 main_message_loop_.Run(); | 223 main_message_loop_.Run(); |
224 WifiDataProvider::Unregister(&loop_quitter.callback_); | 224 WifiDataProvider::Unregister(&loop_quitter.callback_); |
225 WifiDataProvider::ResetFactory(); | 225 WifiDataProvider::ResetFactory(); |
226 } | 226 } |
227 | 227 |
228 } // namespace content | 228 } // namespace content |
OLD | NEW |