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/gateway_data_provider_common.h" | 5 #include "chrome/browser/geolocation/gateway_data_provider_common.h" |
6 | 6 |
7 #include "base/scoped_ptr.h" | 7 #include "base/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" |
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::AtLeast; | 15 using testing::AtLeast; |
16 using testing::DoDefault; | 16 using testing::DoDefault; |
17 using testing::Invoke; | 17 using testing::Invoke; |
18 using testing::Return; | 18 using testing::Return; |
19 | 19 |
| 20 namespace { |
| 21 |
20 class MockGatewayApi : public GatewayDataProviderCommon::GatewayApiInterface { | 22 class MockGatewayApi : public GatewayDataProviderCommon::GatewayApiInterface { |
21 public: | 23 public: |
22 MockGatewayApi() { | 24 MockGatewayApi() { |
23 ON_CALL(*this, GetRouterData(_)) | 25 ON_CALL(*this, GetRouterData(_)) |
24 .WillByDefault(Invoke(this, &MockGatewayApi::GetRouterDataInternal)); | 26 .WillByDefault(Invoke(this, &MockGatewayApi::GetRouterDataInternal)); |
25 } | 27 } |
26 | 28 |
27 MOCK_METHOD1(GetRouterData, bool(GatewayData::RouterDataSet* data)); | 29 MOCK_METHOD1(GetRouterData, bool(GatewayData::RouterDataSet* data)); |
28 | 30 |
29 GatewayData::RouterDataSet data_out_; | 31 GatewayData::RouterDataSet data_out_; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 RouterData single_router; | 180 RouterData single_router; |
179 single_router.mac_address = ASCIIToUTF16("12-34-56-78-54-32"); | 181 single_router.mac_address = ASCIIToUTF16("12-34-56-78-54-32"); |
180 gateway_api_->data_out_.insert(single_router); | 182 gateway_api_->data_out_.insert(single_router); |
181 EXPECT_TRUE(provider_->StartDataProvider()); | 183 EXPECT_TRUE(provider_->StartDataProvider()); |
182 main_message_loop_.Run(); | 184 main_message_loop_.Run(); |
183 GatewayData data; | 185 GatewayData data; |
184 EXPECT_TRUE(provider_->GetData(&data)); | 186 EXPECT_TRUE(provider_->GetData(&data)); |
185 EXPECT_EQ(1, static_cast<int>(data.router_data.size())); | 187 EXPECT_EQ(1, static_cast<int>(data.router_data.size())); |
186 EXPECT_EQ(single_router.mac_address, data.router_data.begin()->mac_address); | 188 EXPECT_EQ(single_router.mac_address, data.router_data.begin()->mac_address); |
187 } | 189 } |
| 190 |
| 191 } // namespace |
OLD | NEW |