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

Side by Side Diff: chrome/browser/chromeos/net/network_portal_detector_unittest.cc

Issue 12263006: Fixed portal detector behaviour for proxied network. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/net/network_portal_detector.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 405
406 CompleteURLFetch(net::OK, 503, retry_after); 406 CompleteURLFetch(net::OK, 503, retry_after);
407 ASSERT_TRUE(is_state_idle()); 407 ASSERT_TRUE(is_state_idle());
408 ASSERT_EQ(3, attempt_count()); 408 ASSERT_EQ(3, attempt_count());
409 CheckPortalState(NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE, 503, 409 CheckPortalState(NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE, 503,
410 wifi1_network()); 410 wifi1_network());
411 } 411 }
412 412
413 TEST_F(NetworkPortalDetectorTest, ProxyAuthRequired) { 413 TEST_F(NetworkPortalDetectorTest, ProxyAuthRequired) {
414 ASSERT_TRUE(is_state_idle()); 414 ASSERT_TRUE(is_state_idle());
415 set_min_time_between_attempts(base::TimeDelta());
415 416
416 SetConnected(wifi1_network()); 417 SetConnected(wifi1_network());
417 CompleteURLFetch(net::OK, 407, NULL); 418 CompleteURLFetch(net::OK, 407, NULL);
419 ASSERT_EQ(1, attempt_count());
420 ASSERT_TRUE(is_state_portal_detection_pending());
421 CheckPortalState(NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN, -1,
422 wifi1_network());
418 423
424 // To run CaptivePortalDetector::DetectCaptivePortal().
425 MessageLoop::current()->RunUntilIdle();
426
427 CompleteURLFetch(net::OK, 407, NULL);
428 ASSERT_EQ(2, attempt_count());
429 ASSERT_TRUE(is_state_portal_detection_pending());
430 CheckPortalState(NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN, -1,
431 wifi1_network());
432
433 // To run CaptivePortalDetector::DetectCaptivePortal().
434 MessageLoop::current()->RunUntilIdle();
435
436 CompleteURLFetch(net::OK, 407, NULL);
437 ASSERT_EQ(3, attempt_count());
419 ASSERT_TRUE(is_state_idle()); 438 ASSERT_TRUE(is_state_idle());
420 CheckPortalState( 439 CheckPortalState(
421 NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED, 407, 440 NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED, 407,
422 wifi1_network()); 441 wifi1_network());
423 } 442 }
424 443
425 TEST_F(NetworkPortalDetectorTest, NoResponseButBehindPortal) { 444 TEST_F(NetworkPortalDetectorTest, NoResponseButBehindPortal) {
426 ASSERT_TRUE(is_state_idle()); 445 ASSERT_TRUE(is_state_idle());
427 set_min_time_between_attempts(base::TimeDelta()); 446 set_min_time_between_attempts(base::TimeDelta());
428 447
(...skipping 23 matching lines...) Expand all
452 NULL); 471 NULL);
453 ASSERT_EQ(3, attempt_count()); 472 ASSERT_EQ(3, attempt_count());
454 ASSERT_TRUE(is_state_idle()); 473 ASSERT_TRUE(is_state_idle());
455 474
456 CheckPortalState(NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL, 475 CheckPortalState(NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL,
457 net::URLFetcher::RESPONSE_CODE_INVALID, 476 net::URLFetcher::RESPONSE_CODE_INVALID,
458 wifi1_network()); 477 wifi1_network());
459 } 478 }
460 479
461 } // namespace chromeos 480 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/net/network_portal_detector.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698