| 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/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 9 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 } | 127 } |
| 128 | 128 |
| 129 protected: | 129 protected: |
| 130 MessageLoop main_message_loop_; | 130 MessageLoop main_message_loop_; |
| 131 MessageLoopQuitListener quit_listener_; | 131 MessageLoopQuitListener quit_listener_; |
| 132 scoped_refptr<WifiDataProviderCommonWithMock> provider_; | 132 scoped_refptr<WifiDataProviderCommonWithMock> provider_; |
| 133 MockWlanApi* wlan_api_; | 133 MockWlanApi* wlan_api_; |
| 134 MockPollingPolicy* polling_policy_; | 134 MockPollingPolicy* polling_policy_; |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 TEST_F(GeolocationWifiDataProviderCommonTest, MacAddressString) { |
| 138 uint8 mac[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
| 139 string16 actual = MacAddressAsString16(mac); |
| 140 string16 expected = ASCIIToUTF16("ff-ff-ff-ff-ff-ff"); |
| 141 EXPECT_EQ(expected, actual); |
| 142 } |
| 143 |
| 137 TEST_F(GeolocationWifiDataProviderCommonTest, CreateDestroy) { | 144 TEST_F(GeolocationWifiDataProviderCommonTest, CreateDestroy) { |
| 138 // Test fixture members were SetUp correctly. | 145 // Test fixture members were SetUp correctly. |
| 139 EXPECT_EQ(&main_message_loop_, MessageLoop::current()); | 146 EXPECT_EQ(&main_message_loop_, MessageLoop::current()); |
| 140 EXPECT_TRUE(NULL != provider_.get()); | 147 EXPECT_TRUE(NULL != provider_.get()); |
| 141 EXPECT_TRUE(NULL != wlan_api_); | 148 EXPECT_TRUE(NULL != wlan_api_); |
| 142 } | 149 } |
| 143 | 150 |
| 144 TEST_F(GeolocationWifiDataProviderCommonTest, StartThread) { | 151 TEST_F(GeolocationWifiDataProviderCommonTest, StartThread) { |
| 145 EXPECT_CALL(*wlan_api_, GetAccessPointData(_)) | 152 EXPECT_CALL(*wlan_api_, GetAccessPointData(_)) |
| 146 .Times(AtLeast(1)); | 153 .Times(AtLeast(1)); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 MessageLoopQuitListener quit_listener(&main_message_loop_); | 232 MessageLoopQuitListener quit_listener(&main_message_loop_); |
| 226 WifiDataProvider::SetFactory(CreateWifiDataProviderCommonWithMock); | 233 WifiDataProvider::SetFactory(CreateWifiDataProviderCommonWithMock); |
| 227 DeviceDataProvider<WifiData>::Register(&quit_listener); | 234 DeviceDataProvider<WifiData>::Register(&quit_listener); |
| 228 main_message_loop_.Run(); | 235 main_message_loop_.Run(); |
| 229 DeviceDataProvider<WifiData>::Unregister(&quit_listener); | 236 DeviceDataProvider<WifiData>::Unregister(&quit_listener); |
| 230 DeviceDataProvider<WifiData>::ResetFactory(); | 237 DeviceDataProvider<WifiData>::ResetFactory(); |
| 231 } | 238 } |
| 232 | 239 |
| 233 } // namespace | 240 } // namespace |
| 234 | 241 |
| OLD | NEW |