| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <list> | 6 #include <list> |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 auth_needed_waiter.Wait(); | 341 auth_needed_waiter.Wait(); |
| 342 WindowedAuthCancelledObserver auth_cancelled_waiter(controller); | 342 WindowedAuthCancelledObserver auth_cancelled_waiter(controller); |
| 343 LoginHandler* handler = *observer.handlers().begin(); | 343 LoginHandler* handler = *observer.handlers().begin(); |
| 344 ASSERT_TRUE(handler); | 344 ASSERT_TRUE(handler); |
| 345 handler->CancelAuth(); | 345 handler->CancelAuth(); |
| 346 auth_cancelled_waiter.Wait(); | 346 auth_cancelled_waiter.Wait(); |
| 347 load_stop_waiter.Wait(); | 347 load_stop_waiter.Wait(); |
| 348 EXPECT_TRUE(observer.handlers().empty()); | 348 EXPECT_TRUE(observer.handlers().empty()); |
| 349 } | 349 } |
| 350 | 350 |
| 351 // Flaky on linux chromeos bots: crbug.com/648826. | |
| 352 #if defined(OS_LINUX) && defined(OS_CHROMEOS) | |
| 353 #define MAYBE_TestCancelAuth_OnNavigation DISABLED_TestCancelAuth_OnNavigation | |
| 354 #else | |
| 355 #define MAYBE_TestCancelAuth_OnNavigation TestCancelAuth_OnNavigation | |
| 356 #endif | |
| 357 // Test login prompt cancellation on navigation to a new page. | 351 // Test login prompt cancellation on navigation to a new page. |
| 358 IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, | 352 IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, TestCancelAuth_OnNavigation) { |
| 359 MAYBE_TestCancelAuth_OnNavigation) { | |
| 360 ASSERT_TRUE(embedded_test_server()->Start()); | 353 ASSERT_TRUE(embedded_test_server()->Start()); |
| 361 const GURL kAuthURL = embedded_test_server()->GetURL(kAuthBasicPage); | 354 const GURL kAuthURL = embedded_test_server()->GetURL(kAuthBasicPage); |
| 362 const GURL kNoAuthURL = embedded_test_server()->GetURL(kNoAuthPage1); | 355 const GURL kNoAuthURL = embedded_test_server()->GetURL(kNoAuthPage1); |
| 363 | 356 |
| 364 NavigationController* controller = | 357 NavigationController* controller = |
| 365 &browser()->tab_strip_model()->GetActiveWebContents()->GetController(); | 358 &browser()->tab_strip_model()->GetActiveWebContents()->GetController(); |
| 366 | 359 |
| 367 LoginPromptBrowserTestObserver observer; | 360 LoginPromptBrowserTestObserver observer; |
| 368 observer.Register(content::Source<NavigationController>(controller)); | 361 observer.Register(content::Source<NavigationController>(controller)); |
| 369 | 362 |
| 370 // One LOAD_STOP event for kAuthURL and one for kNoAuthURL. | 363 // One LOAD_STOP event for LoginInterstitial, second for kAuthURL and third |
| 371 const int kLoadStopEvents = 2; | 364 // for kNoAuthURL. |
| 365 const int kLoadStopEvents = 3; |
| 372 WindowedLoadStopObserver load_stop_waiter(controller, kLoadStopEvents); | 366 WindowedLoadStopObserver load_stop_waiter(controller, kLoadStopEvents); |
| 373 WindowedAuthNeededObserver auth_needed_waiter(controller); | 367 WindowedAuthNeededObserver auth_needed_waiter(controller); |
| 374 browser()->OpenURL(OpenURLParams(kAuthURL, Referrer(), | 368 browser()->OpenURL(OpenURLParams(kAuthURL, Referrer(), |
| 375 WindowOpenDisposition::CURRENT_TAB, | 369 WindowOpenDisposition::CURRENT_TAB, |
| 376 ui::PAGE_TRANSITION_TYPED, false)); | 370 ui::PAGE_TRANSITION_TYPED, false)); |
| 377 auth_needed_waiter.Wait(); | 371 auth_needed_waiter.Wait(); |
| 378 WindowedAuthCancelledObserver auth_cancelled_waiter(controller); | 372 WindowedAuthCancelledObserver auth_cancelled_waiter(controller); |
| 379 // Navigating while auth is requested is the same as cancelling. | 373 // Navigating while auth is requested is the same as cancelling. |
| 380 browser()->OpenURL(OpenURLParams(kNoAuthURL, Referrer(), | 374 browser()->OpenURL(OpenURLParams(kNoAuthURL, Referrer(), |
| 381 WindowOpenDisposition::CURRENT_TAB, | 375 WindowOpenDisposition::CURRENT_TAB, |
| (...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1500 // out. | 1494 // out. |
| 1501 EXPECT_TRUE( | 1495 EXPECT_TRUE( |
| 1502 WaitForRenderFrameReady(contents->GetInterstitialPage()->GetMainFrame())); | 1496 WaitForRenderFrameReady(contents->GetInterstitialPage()->GetMainFrame())); |
| 1503 EXPECT_TRUE(contents->ShowingInterstitialPage()); | 1497 EXPECT_TRUE(contents->ShowingInterstitialPage()); |
| 1504 EXPECT_EQ(SSLBlockingPage::kTypeForTesting, contents->GetInterstitialPage() | 1498 EXPECT_EQ(SSLBlockingPage::kTypeForTesting, contents->GetInterstitialPage() |
| 1505 ->GetDelegateForTesting() | 1499 ->GetDelegateForTesting() |
| 1506 ->GetTypeForTesting()); | 1500 ->GetTypeForTesting()); |
| 1507 } | 1501 } |
| 1508 | 1502 |
| 1509 } // namespace | 1503 } // namespace |
| OLD | NEW |