| 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/prefs/testing_pref_service.h" | 5 #include "base/prefs/testing_pref_service.h" |
| 6 #include "chrome/browser/metrics/variations/eula_accepted_notifier.h" | 6 #include "chrome/browser/metrics/variations/eula_accepted_notifier.h" |
| 7 #include "chrome/browser/metrics/variations/resource_request_allowed_notifier_te
st_util.h" | 7 #include "chrome/browser/metrics/variations/resource_request_allowed_notifier_te
st_util.h" |
| 8 #include "chrome/common/chrome_notification_types.h" | 8 #include "chrome/common/chrome_notification_types.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 27 matching lines...) Expand all Loading... |
| 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() : eula_accepted_(false) { | 48 TestEulaAcceptedNotifier() |
| 49 : EulaAcceptedNotifier(NULL), |
| 50 eula_accepted_(false) { |
| 49 } | 51 } |
| 50 virtual ~TestEulaAcceptedNotifier() { | 52 virtual ~TestEulaAcceptedNotifier() { |
| 51 } | 53 } |
| 52 | 54 |
| 53 virtual bool IsEulaAccepted() OVERRIDE { | 55 virtual bool IsEulaAccepted() OVERRIDE { |
| 54 return eula_accepted_; | 56 return eula_accepted_; |
| 55 } | 57 } |
| 56 | 58 |
| 57 void SetEulaAcceptedForTesting(bool eula_accepted) { | 59 void SetEulaAcceptedForTesting(bool eula_accepted) { |
| 58 eula_accepted_ = eula_accepted; | 60 eula_accepted_ = eula_accepted; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 // calling SimulateResourceRequest here. | 253 // calling SimulateResourceRequest here. |
| 252 DisableEulaAndNetwork(); | 254 DisableEulaAndNetwork(); |
| 253 | 255 |
| 254 SimulateNetworkConnectionChange( | 256 SimulateNetworkConnectionChange( |
| 255 net::NetworkChangeNotifier::CONNECTION_WIFI); | 257 net::NetworkChangeNotifier::CONNECTION_WIFI); |
| 256 EXPECT_FALSE(was_notified()); | 258 EXPECT_FALSE(was_notified()); |
| 257 | 259 |
| 258 SimulateEulaAccepted(); | 260 SimulateEulaAccepted(); |
| 259 EXPECT_FALSE(was_notified()); | 261 EXPECT_FALSE(was_notified()); |
| 260 } | 262 } |
| OLD | NEW |