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 "base/json/json_reader.h" | 5 #include "base/json/json_reader.h" |
6 #include "base/json/json_writer.h" | 6 #include "base/json/json_writer.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 bool got_data_; | 100 bool got_data_; |
101 | 101 |
102 DISALLOW_COPY_AND_ASSIGN(MockWifiDataProvider); | 102 DISALLOW_COPY_AND_ASSIGN(MockWifiDataProvider); |
103 }; | 103 }; |
104 | 104 |
105 MockWifiDataProvider* MockWifiDataProvider::instance_ = NULL; | 105 MockWifiDataProvider* MockWifiDataProvider::instance_ = NULL; |
106 | 106 |
107 // Main test fixture | 107 // Main test fixture |
108 class GeolocationNetworkProviderTest : public testing::Test { | 108 class GeolocationNetworkProviderTest : public testing::Test { |
109 public: | 109 public: |
110 virtual void SetUp() { | 110 void SetUp() override { |
111 test_server_url_ = GURL(kTestServerUrl); | 111 test_server_url_ = GURL(kTestServerUrl); |
112 access_token_store_ = new FakeAccessTokenStore; | 112 access_token_store_ = new FakeAccessTokenStore; |
113 wifi_data_provider_ = MockWifiDataProvider::CreateInstance(); | 113 wifi_data_provider_ = MockWifiDataProvider::CreateInstance(); |
114 } | 114 } |
115 | 115 |
116 virtual void TearDown() { WifiDataProviderManager::ResetFactoryForTesting(); } | 116 void TearDown() override { |
| 117 WifiDataProviderManager::ResetFactoryForTesting(); |
| 118 } |
117 | 119 |
118 LocationProvider* CreateProvider(bool set_permission_granted) { | 120 LocationProvider* CreateProvider(bool set_permission_granted) { |
119 LocationProvider* provider = NewNetworkLocationProvider( | 121 LocationProvider* provider = NewNetworkLocationProvider( |
120 access_token_store_.get(), | 122 access_token_store_.get(), |
121 NULL, // No URLContextGetter needed, as using test urlfecther factory. | 123 NULL, // No URLContextGetter needed, as using test urlfecther factory. |
122 test_server_url_, | 124 test_server_url_, |
123 access_token_store_->access_token_set_[test_server_url_]); | 125 access_token_store_->access_token_set_[test_server_url_]); |
124 if (set_permission_granted) | 126 if (set_permission_granted) |
125 provider->OnPermissionGranted(); | 127 provider->OnPermissionGranted(); |
126 return provider; | 128 return provider; |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(1))); | 548 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(1))); |
547 } else { | 549 } else { |
548 const int evicted = i - kCacheSize; | 550 const int evicted = i - kCacheSize; |
549 EXPECT_FALSE(cache.FindPosition(CreateReferenceWifiScanData(evicted))); | 551 EXPECT_FALSE(cache.FindPosition(CreateReferenceWifiScanData(evicted))); |
550 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(evicted + 1))); | 552 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(evicted + 1))); |
551 } | 553 } |
552 } | 554 } |
553 } | 555 } |
554 | 556 |
555 } // namespace content | 557 } // namespace content |
OLD | NEW |