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

Side by Side Diff: chrome/browser/web_resource/resource_request_allowed_notifier_unittest.cc

Issue 629603002: replace OVERRIDE and FINAL with override and final in chrome/browser/[r-z]* (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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/prefs/testing_pref_service.h" 5 #include "base/prefs/testing_pref_service.h"
6 #include "chrome/browser/chrome_notification_types.h" 6 #include "chrome/browser/chrome_notification_types.h"
7 #include "chrome/browser/web_resource/eula_accepted_notifier.h" 7 #include "chrome/browser/web_resource/eula_accepted_notifier.h"
8 #include "chrome/browser/web_resource/resource_request_allowed_notifier_test_uti l.h" 8 #include "chrome/browser/web_resource/resource_request_allowed_notifier_test_uti l.h"
9 #include "chrome/test/base/testing_browser_process.h" 9 #include "chrome/test/base/testing_browser_process.h"
10 #include "content/public/browser/notification_service.h" 10 #include "content/public/browser/notification_service.h"
(...skipping 12 matching lines...) Expand all
23 // Simulates a change of the connection type to |type|. This will notify any 23 // Simulates a change of the connection type to |type|. This will notify any
24 // objects that are NetworkChangeNotifiers. 24 // objects that are NetworkChangeNotifiers.
25 void SimulateNetworkConnectionChange( 25 void SimulateNetworkConnectionChange(
26 net::NetworkChangeNotifier::ConnectionType type) { 26 net::NetworkChangeNotifier::ConnectionType type) {
27 connection_type_to_return_ = type; 27 connection_type_to_return_ = type;
28 net::NetworkChangeNotifier::NotifyObserversOfConnectionTypeChange(); 28 net::NetworkChangeNotifier::NotifyObserversOfConnectionTypeChange();
29 base::MessageLoop::current()->RunUntilIdle(); 29 base::MessageLoop::current()->RunUntilIdle();
30 } 30 }
31 31
32 private: 32 private:
33 virtual ConnectionType GetCurrentConnectionType() const OVERRIDE { 33 virtual ConnectionType GetCurrentConnectionType() const override {
34 return connection_type_to_return_; 34 return connection_type_to_return_;
35 } 35 }
36 36
37 // The currently simulated network connection type. If this is set to 37 // The currently simulated network connection type. If this is set to
38 // CONNECTION_NONE, then NetworkChangeNotifier::IsOffline will return true. 38 // CONNECTION_NONE, then NetworkChangeNotifier::IsOffline will return true.
39 net::NetworkChangeNotifier::ConnectionType connection_type_to_return_; 39 net::NetworkChangeNotifier::ConnectionType connection_type_to_return_;
40 40
41 DISALLOW_COPY_AND_ASSIGN(TestNetworkChangeNotifier); 41 DISALLOW_COPY_AND_ASSIGN(TestNetworkChangeNotifier);
42 }; 42 };
43 43
44 // EulaAcceptedNotifier test class that allows mocking the EULA accepted state 44 // EulaAcceptedNotifier test class that allows mocking the EULA accepted state
45 // and issuing simulated notifications. 45 // and issuing simulated notifications.
46 class TestEulaAcceptedNotifier : public EulaAcceptedNotifier { 46 class TestEulaAcceptedNotifier : public EulaAcceptedNotifier {
47 public: 47 public:
48 TestEulaAcceptedNotifier() 48 TestEulaAcceptedNotifier()
49 : EulaAcceptedNotifier(NULL), 49 : EulaAcceptedNotifier(NULL),
50 eula_accepted_(false) { 50 eula_accepted_(false) {
51 } 51 }
52 virtual ~TestEulaAcceptedNotifier() { 52 virtual ~TestEulaAcceptedNotifier() {
53 } 53 }
54 54
55 virtual bool IsEulaAccepted() OVERRIDE { 55 virtual bool IsEulaAccepted() override {
56 return eula_accepted_; 56 return eula_accepted_;
57 } 57 }
58 58
59 void SetEulaAcceptedForTesting(bool eula_accepted) { 59 void SetEulaAcceptedForTesting(bool eula_accepted) {
60 eula_accepted_ = eula_accepted; 60 eula_accepted_ = eula_accepted;
61 } 61 }
62 62
63 void SimulateEulaAccepted() { 63 void SimulateEulaAccepted() {
64 NotifyObserver(); 64 NotifyObserver();
65 } 65 }
(...skipping 16 matching lines...) Expand all
82 eula_notifier_(new TestEulaAcceptedNotifier), 82 eula_notifier_(new TestEulaAcceptedNotifier),
83 was_notified_(false) { 83 was_notified_(false) {
84 resource_request_allowed_notifier_.InitWithEulaAcceptNotifier( 84 resource_request_allowed_notifier_.InitWithEulaAcceptNotifier(
85 this, scoped_ptr<EulaAcceptedNotifier>(eula_notifier_)); 85 this, scoped_ptr<EulaAcceptedNotifier>(eula_notifier_));
86 } 86 }
87 virtual ~ResourceRequestAllowedNotifierTest() { } 87 virtual ~ResourceRequestAllowedNotifierTest() { }
88 88
89 bool was_notified() const { return was_notified_; } 89 bool was_notified() const { return was_notified_; }
90 90
91 // ResourceRequestAllowedNotifier::Observer override: 91 // ResourceRequestAllowedNotifier::Observer override:
92 virtual void OnResourceRequestsAllowed() OVERRIDE { 92 virtual void OnResourceRequestsAllowed() override {
93 was_notified_ = true; 93 was_notified_ = true;
94 } 94 }
95 95
96 // Network manipulation methods: 96 // Network manipulation methods:
97 void SetWaitingForNetwork(bool waiting) { 97 void SetWaitingForNetwork(bool waiting) {
98 resource_request_allowed_notifier_.SetWaitingForNetworkForTesting(waiting); 98 resource_request_allowed_notifier_.SetWaitingForNetworkForTesting(waiting);
99 } 99 }
100 100
101 void SimulateNetworkConnectionChange( 101 void SimulateNetworkConnectionChange(
102 net::NetworkChangeNotifier::ConnectionType type) { 102 net::NetworkChangeNotifier::ConnectionType type) {
(...skipping 23 matching lines...) Expand all
126 // Used in tests involving the EULA. Disables both the EULA accepted state 126 // Used in tests involving the EULA. Disables both the EULA accepted state
127 // and the network. 127 // and the network.
128 void DisableEulaAndNetwork() { 128 void DisableEulaAndNetwork() {
129 SetWaitingForNetwork(true); 129 SetWaitingForNetwork(true);
130 SimulateNetworkConnectionChange( 130 SimulateNetworkConnectionChange(
131 net::NetworkChangeNotifier::CONNECTION_NONE); 131 net::NetworkChangeNotifier::CONNECTION_NONE);
132 SetWaitingForEula(true); 132 SetWaitingForEula(true);
133 SetNeedsEulaAcceptance(true); 133 SetNeedsEulaAcceptance(true);
134 } 134 }
135 135
136 virtual void SetUp() OVERRIDE { 136 virtual void SetUp() override {
137 // Assume the test service has already requested permission, as all tests 137 // Assume the test service has already requested permission, as all tests
138 // just test that criteria changes notify the server. 138 // just test that criteria changes notify the server.
139 // Set default EULA state to done (not waiting and EULA accepted) to 139 // Set default EULA state to done (not waiting and EULA accepted) to
140 // simplify non-ChromeOS tests. 140 // simplify non-ChromeOS tests.
141 SetWaitingForEula(false); 141 SetWaitingForEula(false);
142 SetNeedsEulaAcceptance(false); 142 SetNeedsEulaAcceptance(false);
143 } 143 }
144 144
145 private: 145 private:
146 base::MessageLoopForUI message_loop; 146 base::MessageLoopForUI message_loop;
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 // calling SimulateResourceRequest here. 289 // calling SimulateResourceRequest here.
290 DisableEulaAndNetwork(); 290 DisableEulaAndNetwork();
291 291
292 SimulateNetworkConnectionChange( 292 SimulateNetworkConnectionChange(
293 net::NetworkChangeNotifier::CONNECTION_WIFI); 293 net::NetworkChangeNotifier::CONNECTION_WIFI);
294 EXPECT_FALSE(was_notified()); 294 EXPECT_FALSE(was_notified());
295 295
296 SimulateEulaAccepted(); 296 SimulateEulaAccepted();
297 EXPECT_FALSE(was_notified()); 297 EXPECT_FALSE(was_notified());
298 } 298 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698