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

Unified Diff: content/browser/geolocation/network_location_provider_unittest.cc

Issue 10535157: [WIP] attempt to allow chrome OS to inject its wifi data provider (Closed) Base URL: http://git.chromium.org/chromium/src.git@remove_radio
Patch Set: Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/geolocation/network_location_provider_unittest.cc
diff --git a/content/browser/geolocation/network_location_provider_unittest.cc b/content/browser/geolocation/network_location_provider_unittest.cc
index 63de4cab78050097074586ce5fdf574e65dc5180..49f2671539ca59bf9d8d1ed8fca42b8aeb7d1e54 100644
--- a/content/browser/geolocation/network_location_provider_unittest.cc
+++ b/content/browser/geolocation/network_location_provider_unittest.cc
@@ -58,29 +58,27 @@ class MessageLoopQuitListener
// A mock implementation of DeviceDataProviderImplBase for testing. Adapted from
// http://gears.googlecode.com/svn/trunk/gears/geolocation/geolocation_test.cc
-template<typename DataType>
-class MockDeviceDataProviderImpl
- : public DeviceDataProviderImplBase<DataType> {
+class MockWifiDataProviderImpl : public WifiDataProviderImplBase {
public:
// Factory method for use with DeviceDataProvider::SetFactory.
- static DeviceDataProviderImplBase<DataType>* GetInstance() {
+ static WifiDataProviderImplBase* GetInstance() {
CHECK(instance_);
return instance_;
}
- static MockDeviceDataProviderImpl<DataType>* CreateInstance() {
+ static MockWifiDataProviderImpl* CreateInstance() {
CHECK(!instance_);
- instance_ = new MockDeviceDataProviderImpl<DataType>;
+ instance_ = new MockWifiDataProviderImpl;
return instance_;
}
- MockDeviceDataProviderImpl()
+ MockWifiDataProviderImpl()
: start_calls_(0),
stop_calls_(0),
got_data_(true) {
}
- virtual ~MockDeviceDataProviderImpl() {
+ virtual ~MockWifiDataProviderImpl() {
CHECK(this == instance_);
instance_ = NULL;
}
@@ -93,13 +91,13 @@ class MockDeviceDataProviderImpl
virtual void StopDataProvider() {
++stop_calls_;
}
- virtual bool GetData(DataType* data_out) {
+ virtual bool GetData(WifiData* data_out) {
CHECK(data_out);
*data_out = data_;
return got_data_;
}
- void SetData(const DataType& new_data) {
+ void SetData(const WifiData& new_data) {
got_data_ = true;
const bool differs = data_.DiffersSignificantly(new_data);
data_ = new_data;
@@ -112,25 +110,22 @@ class MockDeviceDataProviderImpl
int stop_calls_;
private:
- static MockDeviceDataProviderImpl<DataType>* instance_;
+ static MockWifiDataProviderImpl* instance_;
- DataType data_;
+ WifiData data_;
bool got_data_;
- DISALLOW_COPY_AND_ASSIGN(MockDeviceDataProviderImpl);
+ DISALLOW_COPY_AND_ASSIGN(MockWifiDataProviderImpl);
};
-template<typename DataType>
-MockDeviceDataProviderImpl<DataType>*
-MockDeviceDataProviderImpl<DataType>::instance_ = NULL;
+MockWifiDataProviderImpl* MockWifiDataProviderImpl::instance_ = NULL;
// Main test fixture
class GeolocationNetworkProviderTest : public testing::Test {
public:
virtual void SetUp() {
access_token_store_ = new FakeAccessTokenStore;
- wifi_data_provider_ =
- MockDeviceDataProviderImpl<WifiData>::CreateInstance();
+ wifi_data_provider_ = MockWifiDataProviderImpl::CreateInstance();
}
virtual void TearDown() {
@@ -152,8 +147,7 @@ class GeolocationNetworkProviderTest : public testing::Test {
GeolocationNetworkProviderTest() : test_server_url_(kTestServerUrl) {
// TODO(joth): Really these should be in SetUp, not here, but they take no
// effect on Mac OS Release builds if done there. I kid not. Figure out why.
- WifiDataProvider::SetFactory(
- MockDeviceDataProviderImpl<WifiData>::GetInstance);
+ WifiDataProvider::SetFactory(MockWifiDataProviderImpl::GetInstance);
}
// Returns the current url fetcher (if any) and advances the id ready for the
@@ -268,7 +262,7 @@ class GeolocationNetworkProviderTest : public testing::Test {
MessageLoop main_message_loop_;
scoped_refptr<FakeAccessTokenStore> access_token_store_;
TestURLFetcherFactory url_fetcher_factory_;
- scoped_refptr<MockDeviceDataProviderImpl<WifiData> > wifi_data_provider_;
+ scoped_refptr<MockWifiDataProviderImpl> wifi_data_provider_;
};
« no previous file with comments | « content/browser/geolocation/network_location_provider.h ('k') | content/browser/geolocation/network_location_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698