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

Unified Diff: chrome/browser/chromeos/net/network_portal_detector_impl_unittest.cc

Issue 175243004: Chrome OS: Use Manager.DefaultService for Default Network (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/proxy_config_service_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/net/network_portal_detector_impl_unittest.cc
diff --git a/chrome/browser/chromeos/net/network_portal_detector_impl_unittest.cc b/chrome/browser/chromeos/net/network_portal_detector_impl_unittest.cc
index dea21971c47772d464f23382fcd52561d89841ac..f5898d6b76091ae4a97a74d1732ca56a6f782471 100644
--- a/chrome/browser/chromeos/net/network_portal_detector_impl_unittest.cc
+++ b/chrome/browser/chromeos/net/network_portal_detector_impl_unittest.cc
@@ -31,6 +31,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
+using testing::AnyNumber;
using testing::Mock;
using testing::_;
@@ -388,12 +389,22 @@ TEST_F(NetworkPortalDetectorImplTest, Online2Offline) {
MockObserver observer;
network_portal_detector()->AddObserver(&observer);
+ NetworkPortalDetector::CaptivePortalState offline_state;
+ offline_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE;
+
// WiFi is in online state.
{
- NetworkPortalDetector::CaptivePortalState state;
- state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE;
- state.response_code = 204;
- EXPECT_CALL(observer, OnPortalDetectionCompleted(_, state)).Times(1);
+ // When transitioning to a connected state, the network will transition to
+ // connecting states which will set the default network to NULL. This may
+ // get triggered multiple times.
+ EXPECT_CALL(observer, OnPortalDetectionCompleted(_, offline_state))
+ .Times(AnyNumber());
+
+ // Expect a single transition to an online state.
+ NetworkPortalDetector::CaptivePortalState online_state;
+ online_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE;
+ online_state.response_code = 204;
+ EXPECT_CALL(observer, OnPortalDetectionCompleted(_, online_state)).Times(1);
SetConnected(kStubWireless1);
ASSERT_TRUE(is_state_checking_for_portal());
@@ -407,9 +418,8 @@ TEST_F(NetworkPortalDetectorImplTest, Online2Offline) {
// WiFi is turned off.
{
- NetworkPortalDetector::CaptivePortalState state;
- state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE;
- EXPECT_CALL(observer, OnPortalDetectionCompleted(NULL, state)).Times(1);
+ EXPECT_CALL(observer, OnPortalDetectionCompleted(NULL, offline_state))
+ .Times(1);
SetDisconnected(kStubWireless1);
ASSERT_TRUE(is_state_idle());
« no previous file with comments | « no previous file | chrome/browser/chromeos/proxy_config_service_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698