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

Side by Side Diff: net/proxy/proxy_config_service_linux_unittest.cc

Issue 623213004: replace OVERRIDE and FINAL with override and final in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: undo unwanted change in comment Created 6 years, 2 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
« no previous file with comments | « net/proxy/proxy_config_service_linux.cc ('k') | net/proxy/proxy_config_service_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "net/proxy/proxy_config_service_linux.h" 5 #include "net/proxy/proxy_config_service_linux.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 Reset(); 100 Reset();
101 } 101 }
102 102
103 // Zeroes all environment values. 103 // Zeroes all environment values.
104 void Reset() { 104 void Reset() {
105 EnvVarValues zero_values = { 0 }; 105 EnvVarValues zero_values = { 0 };
106 values = zero_values; 106 values = zero_values;
107 } 107 }
108 108
109 // Begin base::Environment implementation. 109 // Begin base::Environment implementation.
110 virtual bool GetVar(const char* variable_name, std::string* result) OVERRIDE { 110 virtual bool GetVar(const char* variable_name, std::string* result) override {
111 std::map<std::string, const char**>::iterator it = 111 std::map<std::string, const char**>::iterator it =
112 table.find(variable_name); 112 table.find(variable_name);
113 if (it != table.end() && *(it->second) != NULL) { 113 if (it != table.end() && *(it->second) != NULL) {
114 // Note that the variable may be defined but empty. 114 // Note that the variable may be defined but empty.
115 *result = *(it->second); 115 *result = *(it->second);
116 return true; 116 return true;
117 } 117 }
118 return false; 118 return false;
119 } 119 }
120 120
121 virtual bool SetVar(const char* variable_name, const std::string& new_value) 121 virtual bool SetVar(const char* variable_name, const std::string& new_value)
122 OVERRIDE { 122 override {
123 ADD_FAILURE(); 123 ADD_FAILURE();
124 return false; 124 return false;
125 } 125 }
126 126
127 virtual bool UnSetVar(const char* variable_name) OVERRIDE { 127 virtual bool UnSetVar(const char* variable_name) override {
128 ADD_FAILURE(); 128 ADD_FAILURE();
129 return false; 129 return false;
130 } 130 }
131 // End base::Environment implementation. 131 // End base::Environment implementation.
132 132
133 // Intentionally public, for convenience when setting up a test. 133 // Intentionally public, for convenience when setting up a test.
134 EnvVarValues values; 134 EnvVarValues values;
135 135
136 private: 136 private:
137 std::map<std::string, const char**> table; 137 std::map<std::string, const char**> table;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 171
172 // Zeros all environment values. 172 // Zeros all environment values.
173 void Reset() { 173 void Reset() {
174 GConfValues zero_values = { 0 }; 174 GConfValues zero_values = { 0 };
175 values = zero_values; 175 values = zero_values;
176 } 176 }
177 177
178 virtual bool Init( 178 virtual bool Init(
179 const scoped_refptr<base::SingleThreadTaskRunner>& glib_task_runner, 179 const scoped_refptr<base::SingleThreadTaskRunner>& glib_task_runner,
180 const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner) 180 const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner)
181 OVERRIDE { 181 override {
182 task_runner_ = glib_task_runner; 182 task_runner_ = glib_task_runner;
183 return true; 183 return true;
184 } 184 }
185 185
186 virtual void ShutDown() OVERRIDE {} 186 virtual void ShutDown() override {}
187 187
188 virtual bool SetUpNotifications(ProxyConfigServiceLinux::Delegate* delegate) 188 virtual bool SetUpNotifications(ProxyConfigServiceLinux::Delegate* delegate)
189 OVERRIDE { 189 override {
190 return true; 190 return true;
191 } 191 }
192 192
193 virtual const scoped_refptr<base::SingleThreadTaskRunner>& 193 virtual const scoped_refptr<base::SingleThreadTaskRunner>&
194 GetNotificationTaskRunner() OVERRIDE { 194 GetNotificationTaskRunner() override {
195 return task_runner_; 195 return task_runner_;
196 } 196 }
197 197
198 virtual ProxyConfigSource GetConfigSource() OVERRIDE { 198 virtual ProxyConfigSource GetConfigSource() override {
199 return PROXY_CONFIG_SOURCE_TEST; 199 return PROXY_CONFIG_SOURCE_TEST;
200 } 200 }
201 201
202 virtual bool GetString(StringSetting key, std::string* result) OVERRIDE { 202 virtual bool GetString(StringSetting key, std::string* result) override {
203 const char* value = strings_table.Get(key); 203 const char* value = strings_table.Get(key);
204 if (value) { 204 if (value) {
205 *result = value; 205 *result = value;
206 return true; 206 return true;
207 } 207 }
208 return false; 208 return false;
209 } 209 }
210 210
211 virtual bool GetBool(BoolSetting key, bool* result) OVERRIDE { 211 virtual bool GetBool(BoolSetting key, bool* result) override {
212 BoolSettingValue value = bools_table.Get(key); 212 BoolSettingValue value = bools_table.Get(key);
213 switch (value) { 213 switch (value) {
214 case UNSET: 214 case UNSET:
215 return false; 215 return false;
216 case TRUE: 216 case TRUE:
217 *result = true; 217 *result = true;
218 break; 218 break;
219 case FALSE: 219 case FALSE:
220 *result = false; 220 *result = false;
221 } 221 }
222 return true; 222 return true;
223 } 223 }
224 224
225 virtual bool GetInt(IntSetting key, int* result) OVERRIDE { 225 virtual bool GetInt(IntSetting key, int* result) override {
226 // We don't bother to distinguish unset keys from 0 values. 226 // We don't bother to distinguish unset keys from 0 values.
227 *result = ints_table.Get(key); 227 *result = ints_table.Get(key);
228 return true; 228 return true;
229 } 229 }
230 230
231 virtual bool GetStringList(StringListSetting key, 231 virtual bool GetStringList(StringListSetting key,
232 std::vector<std::string>* result) OVERRIDE { 232 std::vector<std::string>* result) override {
233 *result = string_lists_table.Get(key); 233 *result = string_lists_table.Get(key);
234 // We don't bother to distinguish unset keys from empty lists. 234 // We don't bother to distinguish unset keys from empty lists.
235 return !result->empty(); 235 return !result->empty();
236 } 236 }
237 237
238 virtual bool BypassListIsReversed() OVERRIDE { 238 virtual bool BypassListIsReversed() override {
239 return false; 239 return false;
240 } 240 }
241 241
242 virtual bool MatchHostsUsingSuffixMatching() OVERRIDE { 242 virtual bool MatchHostsUsingSuffixMatching() override {
243 return false; 243 return false;
244 } 244 }
245 245
246 // Intentionally public, for convenience when setting up a test. 246 // Intentionally public, for convenience when setting up a test.
247 GConfValues values; 247 GConfValues values;
248 248
249 private: 249 private:
250 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 250 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
251 SettingsTable<StringSetting, const char*> strings_table; 251 SettingsTable<StringSetting, const char*> strings_table;
252 SettingsTable<BoolSetting, BoolSettingValue> bools_table; 252 SettingsTable<BoolSetting, BoolSettingValue> bools_table;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 net::ProxyConfigService::ConfigAvailability get_latest_config_result_; 348 net::ProxyConfigService::ConfigAvailability get_latest_config_result_;
349 }; 349 };
350 350
351 namespace net { 351 namespace net {
352 352
353 // This test fixture is only really needed for the KDEConfigParser test case, 353 // This test fixture is only really needed for the KDEConfigParser test case,
354 // but all the test cases with the same prefix ("ProxyConfigServiceLinuxTest") 354 // but all the test cases with the same prefix ("ProxyConfigServiceLinuxTest")
355 // must use the same test fixture class (also "ProxyConfigServiceLinuxTest"). 355 // must use the same test fixture class (also "ProxyConfigServiceLinuxTest").
356 class ProxyConfigServiceLinuxTest : public PlatformTest { 356 class ProxyConfigServiceLinuxTest : public PlatformTest {
357 protected: 357 protected:
358 virtual void SetUp() OVERRIDE { 358 virtual void SetUp() override {
359 PlatformTest::SetUp(); 359 PlatformTest::SetUp();
360 // Set up a temporary KDE home directory. 360 // Set up a temporary KDE home directory.
361 std::string prefix("ProxyConfigServiceLinuxTest_user_home"); 361 std::string prefix("ProxyConfigServiceLinuxTest_user_home");
362 base::CreateNewTempDirectory(prefix, &user_home_); 362 base::CreateNewTempDirectory(prefix, &user_home_);
363 kde_home_ = user_home_.Append(FILE_PATH_LITERAL(".kde")); 363 kde_home_ = user_home_.Append(FILE_PATH_LITERAL(".kde"));
364 base::FilePath path = kde_home_.Append(FILE_PATH_LITERAL("share")); 364 base::FilePath path = kde_home_.Append(FILE_PATH_LITERAL("share"));
365 path = path.Append(FILE_PATH_LITERAL("config")); 365 path = path.Append(FILE_PATH_LITERAL("config"));
366 base::CreateDirectory(path); 366 base::CreateDirectory(path);
367 kioslaverc_ = path.Append(FILE_PATH_LITERAL("kioslaverc")); 367 kioslaverc_ = path.Append(FILE_PATH_LITERAL("kioslaverc"));
368 // Set up paths but do not create the directory for .kde4. 368 // Set up paths but do not create the directory for .kde4.
369 kde4_home_ = user_home_.Append(FILE_PATH_LITERAL(".kde4")); 369 kde4_home_ = user_home_.Append(FILE_PATH_LITERAL(".kde4"));
370 path = kde4_home_.Append(FILE_PATH_LITERAL("share")); 370 path = kde4_home_.Append(FILE_PATH_LITERAL("share"));
371 kde4_config_ = path.Append(FILE_PATH_LITERAL("config")); 371 kde4_config_ = path.Append(FILE_PATH_LITERAL("config"));
372 kioslaverc4_ = kde4_config_.Append(FILE_PATH_LITERAL("kioslaverc")); 372 kioslaverc4_ = kde4_config_.Append(FILE_PATH_LITERAL("kioslaverc"));
373 } 373 }
374 374
375 virtual void TearDown() OVERRIDE { 375 virtual void TearDown() override {
376 // Delete the temporary KDE home directory. 376 // Delete the temporary KDE home directory.
377 base::DeleteFile(user_home_, true); 377 base::DeleteFile(user_home_, true);
378 PlatformTest::TearDown(); 378 PlatformTest::TearDown();
379 } 379 }
380 380
381 base::FilePath user_home_; 381 base::FilePath user_home_;
382 // KDE3 paths. 382 // KDE3 paths.
383 base::FilePath kde_home_; 383 base::FilePath kde_home_;
384 base::FilePath kioslaverc_; 384 base::FilePath kioslaverc_;
385 // KDE4 paths. 385 // KDE4 paths.
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1611 ProxyConfig config; 1611 ProxyConfig config;
1612 sync_config_getter.SetupAndInitialFetch(); 1612 sync_config_getter.SetupAndInitialFetch();
1613 EXPECT_EQ(ProxyConfigService::CONFIG_VALID, 1613 EXPECT_EQ(ProxyConfigService::CONFIG_VALID,
1614 sync_config_getter.SyncGetLatestProxyConfig(&config)); 1614 sync_config_getter.SyncGetLatestProxyConfig(&config));
1615 EXPECT_TRUE(config.auto_detect()); 1615 EXPECT_TRUE(config.auto_detect());
1616 EXPECT_EQ(GURL(), config.pac_url()); 1616 EXPECT_EQ(GURL(), config.pac_url());
1617 } 1617 }
1618 } 1618 }
1619 1619
1620 } // namespace net 1620 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_config_service_linux.cc ('k') | net/proxy/proxy_config_service_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698