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 "chrome/browser/metrics/variations/resource_request_allowed_notifier_te st_util.h" | 5 #include "chrome/browser/metrics/variations/resource_request_allowed_notifier_te st_util.h" |
6 #include "chrome/common/chrome_notification_types.h" | 6 #include "chrome/common/chrome_notification_types.h" |
7 #include "chrome/test/base/testing_browser_process.h" | 7 #include "chrome/test/base/testing_browser_process.h" |
8 #include "chrome/test/base/testing_pref_service.h" | 8 #include "chrome/test/base/testing_pref_service.h" |
9 #include "content/public/browser/notification_service.h" | 9 #include "content/public/browser/notification_service.h" |
10 #include "content/public/test/test_browser_thread.h" | 10 #include "content/public/test/test_browser_thread.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 // Override NetworkChangeNotifier to simulate connection type changes for tests. | 13 // Override NetworkChangeNotifier to simulate connection type changes for tests. |
14 class TestNetworkChangeNotifier : public net::NetworkChangeNotifier { | 14 class TestNetworkChangeNotifier : public net::NetworkChangeNotifier { |
15 public: | 15 public: |
16 TestNetworkChangeNotifier() | 16 TestNetworkChangeNotifier() |
17 : net::NetworkChangeNotifier(), | 17 : net::NetworkChangeNotifier( |
szym
2012/11/27 22:22:05
I'd be okay with a default constructor for the sol
| |
18 net::NetworkChangeNotifier::NetworkChangeCalculatorParams()), | |
18 connection_type_to_return_( | 19 connection_type_to_return_( |
19 net::NetworkChangeNotifier::CONNECTION_UNKNOWN) { | 20 net::NetworkChangeNotifier::CONNECTION_UNKNOWN) { |
20 } | 21 } |
21 | 22 |
22 // 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 |
23 // objects that are NetworkChangeNotifiers. | 24 // objects that are NetworkChangeNotifiers. |
24 void SimulateNetworkConnectionChange( | 25 void SimulateNetworkConnectionChange( |
25 net::NetworkChangeNotifier::ConnectionType type) { | 26 net::NetworkChangeNotifier::ConnectionType type) { |
26 connection_type_to_return_ = type; | 27 connection_type_to_return_ = type; |
27 net::NetworkChangeNotifier::NotifyObserversOfConnectionTypeChange(); | 28 net::NetworkChangeNotifier::NotifyObserversOfConnectionTypeChange(); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
235 DisableEulaAndNetwork(); | 236 DisableEulaAndNetwork(); |
236 | 237 |
237 SimulateNetworkConnectionChange( | 238 SimulateNetworkConnectionChange( |
238 net::NetworkChangeNotifier::CONNECTION_WIFI); | 239 net::NetworkChangeNotifier::CONNECTION_WIFI); |
239 EXPECT_FALSE(was_notified()); | 240 EXPECT_FALSE(was_notified()); |
240 | 241 |
241 SimulateEulaAccepted(); | 242 SimulateEulaAccepted(); |
242 EXPECT_FALSE(was_notified()); | 243 EXPECT_FALSE(was_notified()); |
243 } | 244 } |
244 #endif // OS_CHROMEOS | 245 #endif // OS_CHROMEOS |
OLD | NEW |