Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: device/geolocation/wifi_data_provider_common_unittest.cc

Issue 2833273002: Geolocation cleanup: use unique_ptr<>s and rename New{WlanApi/PollingPolicy} to CreateBla() (Closed)
Patch Set: reillyg@s nits Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "device/geolocation/wifi_data_provider_common.h" 5 #include "device/geolocation/wifi_data_provider_common.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 MOCK_METHOD0(PollingInterval, int()); 55 MOCK_METHOD0(PollingInterval, int());
56 MOCK_METHOD0(NoWifiInterval, int()); 56 MOCK_METHOD0(NoWifiInterval, int());
57 }; 57 };
58 58
59 class WifiDataProviderCommonWithMock : public WifiDataProviderCommon { 59 class WifiDataProviderCommonWithMock : public WifiDataProviderCommon {
60 public: 60 public:
61 WifiDataProviderCommonWithMock() 61 WifiDataProviderCommonWithMock()
62 : wlan_api_(new MockWlanApi), polling_policy_(new MockPollingPolicy) {} 62 : wlan_api_(new MockWlanApi), polling_policy_(new MockPollingPolicy) {}
63 63
64 // WifiDataProviderCommon 64 // WifiDataProviderCommon
65 WlanApiInterface* NewWlanApi() override { return wlan_api_.release(); } 65 std::unique_ptr<WlanApiInterface> CreateWlanApi() override {
66 WifiPollingPolicy* NewPollingPolicy() override { 66 return std::move(wlan_api_);
67 return polling_policy_.release(); 67 }
68 std::unique_ptr<WifiPollingPolicy> CreatePollingPolicy() override {
69 return std::move(polling_policy_);
68 } 70 }
69 71
70 std::unique_ptr<MockWlanApi> wlan_api_; 72 std::unique_ptr<MockWlanApi> wlan_api_;
71 std::unique_ptr<MockPollingPolicy> polling_policy_; 73 std::unique_ptr<MockPollingPolicy> polling_policy_;
72 74
73 private: 75 private:
74 ~WifiDataProviderCommonWithMock() override {} 76 ~WifiDataProviderCommonWithMock() override {}
75 77
76 DISALLOW_COPY_AND_ASSIGN(WifiDataProviderCommonWithMock); 78 DISALLOW_COPY_AND_ASSIGN(WifiDataProviderCommonWithMock);
77 }; 79 };
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 provider_->StartDataProvider(); 186 provider_->StartDataProvider();
185 run_loop.Run(); 187 run_loop.Run();
186 188
187 WifiData data; 189 WifiData data;
188 EXPECT_TRUE(provider_->GetData(&data)); 190 EXPECT_TRUE(provider_->GetData(&data));
189 ASSERT_EQ(1u, data.access_point_data.size()); 191 ASSERT_EQ(1u, data.access_point_data.size());
190 EXPECT_EQ(single_access_point.ssid, data.access_point_data.begin()->ssid); 192 EXPECT_EQ(single_access_point.ssid, data.access_point_data.begin()->ssid);
191 } 193 }
192 194
193 } // namespace device 195 } // namespace device
OLDNEW
« no previous file with comments | « device/geolocation/wifi_data_provider_common.cc ('k') | device/geolocation/wifi_data_provider_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698