| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/geolocation/wifi_data_provider_common.h" | 5 #include "chrome/browser/geolocation/wifi_data_provider_common.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 11 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 using testing::_; | 16 using testing::_; |
| 17 using testing::AtLeast; | 17 using testing::AtLeast; |
| 18 using testing::DoDefault; | 18 using testing::DoDefault; |
| 19 using testing::Invoke; | 19 using testing::Invoke; |
| 20 using testing::Return; | 20 using testing::Return; |
| 21 | 21 |
| 22 namespace { |
| 23 |
| 22 class MockWlanApi : public WifiDataProviderCommon::WlanApiInterface { | 24 class MockWlanApi : public WifiDataProviderCommon::WlanApiInterface { |
| 23 public: | 25 public: |
| 24 MockWlanApi() : calls_(0), bool_return_(true) { | 26 MockWlanApi() : calls_(0), bool_return_(true) { |
| 25 ANNOTATE_BENIGN_RACE(&calls_, "This is a test-only data race on a counter"); | 27 ANNOTATE_BENIGN_RACE(&calls_, "This is a test-only data race on a counter"); |
| 26 ON_CALL(*this, GetAccessPointData(_)) | 28 ON_CALL(*this, GetAccessPointData(_)) |
| 27 .WillByDefault(Invoke(this, &MockWlanApi::GetAccessPointDataInternal)); | 29 .WillByDefault(Invoke(this, &MockWlanApi::GetAccessPointDataInternal)); |
| 28 } | 30 } |
| 29 | 31 |
| 30 MOCK_METHOD1(GetAccessPointData, bool(WifiData::AccessPointDataSet* data)); | 32 MOCK_METHOD1(GetAccessPointData, bool(WifiData::AccessPointDataSet* data)); |
| 31 | 33 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 220 |
| 219 TEST_F(GeolocationWifiDataProviderCommonTest, | 221 TEST_F(GeolocationWifiDataProviderCommonTest, |
| 220 StartThreadViaDeviceDataProvider) { | 222 StartThreadViaDeviceDataProvider) { |
| 221 MessageLoopQuitListener quit_listener(&main_message_loop_); | 223 MessageLoopQuitListener quit_listener(&main_message_loop_); |
| 222 WifiDataProvider::SetFactory(CreateWifiDataProviderCommonWithMock); | 224 WifiDataProvider::SetFactory(CreateWifiDataProviderCommonWithMock); |
| 223 DeviceDataProvider<WifiData>::Register(&quit_listener); | 225 DeviceDataProvider<WifiData>::Register(&quit_listener); |
| 224 main_message_loop_.Run(); | 226 main_message_loop_.Run(); |
| 225 DeviceDataProvider<WifiData>::Unregister(&quit_listener); | 227 DeviceDataProvider<WifiData>::Unregister(&quit_listener); |
| 226 DeviceDataProvider<WifiData>::ResetFactory(); | 228 DeviceDataProvider<WifiData>::ResetFactory(); |
| 227 } | 229 } |
| 230 |
| 231 } // namespace |
| 232 |
| OLD | NEW |