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

Side by Side Diff: chrome/browser/metrics/variations/variations_service_unittest.cc

Issue 624173002: replace OVERRIDE and FINAL with override and final in chrome/browser/[j-q]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master 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
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 "chrome/browser/metrics/variations/variations_service.h" 5 #include "chrome/browser/metrics/variations/variations_service.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/prefs/testing_pref_service.h" 10 #include "base/prefs/testing_pref_service.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 void set_intercepts_fetch(bool value) { 53 void set_intercepts_fetch(bool value) {
54 intercepts_fetch_ = value; 54 intercepts_fetch_ = value;
55 } 55 }
56 56
57 bool fetch_attempted() const { return fetch_attempted_; } 57 bool fetch_attempted() const { return fetch_attempted_; }
58 58
59 bool seed_stored() const { return seed_stored_; } 59 bool seed_stored() const { return seed_stored_; }
60 60
61 virtual void DoActualFetch() OVERRIDE { 61 virtual void DoActualFetch() override {
62 if (intercepts_fetch_) { 62 if (intercepts_fetch_) {
63 fetch_attempted_ = true; 63 fetch_attempted_ = true;
64 return; 64 return;
65 } 65 }
66 66
67 VariationsService::DoActualFetch(); 67 VariationsService::DoActualFetch();
68 } 68 }
69 69
70 protected: 70 protected:
71 virtual void StoreSeed(const std::string& seed_data, 71 virtual void StoreSeed(const std::string& seed_data,
72 const std::string& seed_signature, 72 const std::string& seed_signature,
73 const base::Time& date_fetched) OVERRIDE { 73 const base::Time& date_fetched) override {
74 seed_stored_ = true; 74 seed_stored_ = true;
75 } 75 }
76 76
77 private: 77 private:
78 bool intercepts_fetch_; 78 bool intercepts_fetch_;
79 bool fetch_attempted_; 79 bool fetch_attempted_;
80 bool seed_stored_; 80 bool seed_stored_;
81 81
82 DISALLOW_COPY_AND_ASSIGN(TestVariationsService); 82 DISALLOW_COPY_AND_ASSIGN(TestVariationsService);
83 }; 83 };
84 84
85 class TestVariationsServiceObserver : public VariationsService::Observer { 85 class TestVariationsServiceObserver : public VariationsService::Observer {
86 public: 86 public:
87 TestVariationsServiceObserver() 87 TestVariationsServiceObserver()
88 : best_effort_changes_notified_(0), 88 : best_effort_changes_notified_(0),
89 crticial_changes_notified_(0) { 89 crticial_changes_notified_(0) {
90 } 90 }
91 virtual ~TestVariationsServiceObserver() { 91 virtual ~TestVariationsServiceObserver() {
92 } 92 }
93 93
94 virtual void OnExperimentChangesDetected(Severity severity) OVERRIDE { 94 virtual void OnExperimentChangesDetected(Severity severity) override {
95 switch (severity) { 95 switch (severity) {
96 case BEST_EFFORT: 96 case BEST_EFFORT:
97 ++best_effort_changes_notified_; 97 ++best_effort_changes_notified_;
98 break; 98 break;
99 case CRITICAL: 99 case CRITICAL:
100 ++crticial_changes_notified_; 100 ++crticial_changes_notified_;
101 break; 101 break;
102 } 102 }
103 } 103 }
104 104
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 url = VariationsService::GetVariationsServerURL(&prefs); 191 url = VariationsService::GetVariationsServerURL(&prefs);
192 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); 192 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true));
193 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); 193 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value));
194 EXPECT_EQ("restricted", value); 194 EXPECT_EQ("restricted", value);
195 } 195 }
196 #else 196 #else
197 class VariationsServiceTestChromeOS : public VariationsServiceTest { 197 class VariationsServiceTestChromeOS : public VariationsServiceTest {
198 protected: 198 protected:
199 VariationsServiceTestChromeOS() {} 199 VariationsServiceTestChromeOS() {}
200 200
201 virtual void SetUp() OVERRIDE { 201 virtual void SetUp() override {
202 cros_settings_ = chromeos::CrosSettings::Get(); 202 cros_settings_ = chromeos::CrosSettings::Get();
203 DCHECK(cros_settings_ != NULL); 203 DCHECK(cros_settings_ != NULL);
204 // Remove the real DeviceSettingsProvider and replace it with a stub that 204 // Remove the real DeviceSettingsProvider and replace it with a stub that
205 // allows modifications in a test. 205 // allows modifications in a test.
206 device_settings_provider_ = cros_settings_->GetProvider( 206 device_settings_provider_ = cros_settings_->GetProvider(
207 chromeos::kReportDeviceVersionInfo); 207 chromeos::kReportDeviceVersionInfo);
208 EXPECT_TRUE(device_settings_provider_ != NULL); 208 EXPECT_TRUE(device_settings_provider_ != NULL);
209 EXPECT_TRUE(cros_settings_->RemoveSettingsProvider( 209 EXPECT_TRUE(cros_settings_->RemoveSettingsProvider(
210 device_settings_provider_)); 210 device_settings_provider_));
211 cros_settings_->AddSettingsProvider(&stub_settings_provider_); 211 cros_settings_->AddSettingsProvider(&stub_settings_provider_);
212 } 212 }
213 213
214 virtual void TearDown() OVERRIDE { 214 virtual void TearDown() override {
215 // Restore the real DeviceSettingsProvider. 215 // Restore the real DeviceSettingsProvider.
216 EXPECT_TRUE( 216 EXPECT_TRUE(
217 cros_settings_->RemoveSettingsProvider(&stub_settings_provider_)); 217 cros_settings_->RemoveSettingsProvider(&stub_settings_provider_));
218 cros_settings_->AddSettingsProvider(device_settings_provider_); 218 cros_settings_->AddSettingsProvider(device_settings_provider_);
219 } 219 }
220 220
221 void SetVariationsRestrictParameterPolicyValue(std::string value) { 221 void SetVariationsRestrictParameterPolicyValue(std::string value) {
222 cros_settings_->SetString(chromeos::kVariationsRestrictParameter, value); 222 cros_settings_->SetString(chromeos::kVariationsRestrictParameter, value);
223 } 223 }
224 224
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 EXPECT_EQ(cases[i].expected_best_effort_notifications, 406 EXPECT_EQ(cases[i].expected_best_effort_notifications,
407 observer.best_effort_changes_notified()) << i; 407 observer.best_effort_changes_notified()) << i;
408 EXPECT_EQ(cases[i].expected_crtical_notifications, 408 EXPECT_EQ(cases[i].expected_crtical_notifications,
409 observer.crticial_changes_notified()) << i; 409 observer.crticial_changes_notified()) << i;
410 410
411 service.RemoveObserver(&observer); 411 service.RemoveObserver(&observer);
412 } 412 }
413 } 413 }
414 414
415 } // namespace chrome_variations 415 } // namespace chrome_variations
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698