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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/prerender/prerender_manager.h" | 10 #include "chrome/browser/prerender/prerender_manager.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_commands.h" | 12 #include "chrome/browser/ui/browser_commands.h" |
13 #include "chrome/browser/ui/browser_tabstrip.h" | 13 #include "chrome/browser/ui/browser_tabstrip.h" |
14 #include "chrome/browser/ui/login/login_prompt.h" | 14 #include "chrome/browser/ui/login/login_prompt.h" |
15 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
16 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
17 #include "chrome/test/base/ui_test_utils.h" | 17 #include "chrome/test/base/ui_test_utils.h" |
18 #include "content/public/browser/notification_details.h" | 18 #include "content/public/browser/notification_details.h" |
19 #include "content/public/browser/notification_source.h" | 19 #include "content/public/browser/notification_source.h" |
20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
21 #include "content/public/test/browser_test_utils.h" | 21 #include "content/public/test/browser_test_utils.h" |
22 #include "content/public/test/test_browser_thread.h" | |
23 #include "net/base/auth.h" | 22 #include "net/base/auth.h" |
24 #include "net/base/mock_host_resolver.h" | 23 #include "net/base/mock_host_resolver.h" |
25 | 24 |
26 using content::NavigationController; | 25 using content::NavigationController; |
27 using content::OpenURLParams; | 26 using content::OpenURLParams; |
28 using content::Referrer; | 27 using content::Referrer; |
29 | 28 |
30 namespace { | 29 namespace { |
31 | 30 |
32 class LoginPromptBrowserTest : public InProcessBrowserTest { | 31 class LoginPromptBrowserTest : public InProcessBrowserTest { |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 // go back to. | 440 // go back to. |
442 ui_test_utils::NavigateToURL(browser(), no_auth_page_1); | 441 ui_test_utils::NavigateToURL(browser(), no_auth_page_1); |
443 | 442 |
444 // Navigating while auth is requested is the same as cancelling. | 443 // Navigating while auth is requested is the same as cancelling. |
445 { | 444 { |
446 // We need to wait for two LOAD_STOP events. One for auth_page and one for | 445 // We need to wait for two LOAD_STOP events. One for auth_page and one for |
447 // no_auth_page_2. | 446 // no_auth_page_2. |
448 WindowedLoadStopObserver load_stop_waiter(controller, 2); | 447 WindowedLoadStopObserver load_stop_waiter(controller, 2); |
449 WindowedAuthNeededObserver auth_needed_waiter(controller); | 448 WindowedAuthNeededObserver auth_needed_waiter(controller); |
450 browser()->OpenURL(OpenURLParams( | 449 browser()->OpenURL(OpenURLParams( |
451 auth_page, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, fals
e)); | 450 auth_page, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, |
| 451 false)); |
452 auth_needed_waiter.Wait(); | 452 auth_needed_waiter.Wait(); |
453 WindowedAuthCancelledObserver auth_cancelled_waiter(controller); | 453 WindowedAuthCancelledObserver auth_cancelled_waiter(controller); |
454 browser()->OpenURL(OpenURLParams( | 454 browser()->OpenURL(OpenURLParams( |
455 no_auth_page_2, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, | 455 no_auth_page_2, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, |
456 false)); | 456 false)); |
457 auth_cancelled_waiter.Wait(); | 457 auth_cancelled_waiter.Wait(); |
458 load_stop_waiter.Wait(); | 458 load_stop_waiter.Wait(); |
459 EXPECT_TRUE(observer.handlers_.empty()); | 459 EXPECT_TRUE(observer.handlers_.empty()); |
460 } | 460 } |
461 | 461 |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 EXPECT_EQ(1, observer.auth_needed_count_); | 1002 EXPECT_EQ(1, observer.auth_needed_count_); |
1003 EXPECT_EQ(1, observer.auth_supplied_count_); | 1003 EXPECT_EQ(1, observer.auth_supplied_count_); |
1004 EXPECT_EQ(0, observer.auth_cancelled_count_); | 1004 EXPECT_EQ(0, observer.auth_cancelled_count_); |
1005 EXPECT_EQ(1, observer_incognito.auth_needed_count_); | 1005 EXPECT_EQ(1, observer_incognito.auth_needed_count_); |
1006 EXPECT_EQ(0, observer_incognito.auth_supplied_count_); | 1006 EXPECT_EQ(0, observer_incognito.auth_supplied_count_); |
1007 EXPECT_EQ(0, observer_incognito.auth_cancelled_count_); | 1007 EXPECT_EQ(0, observer_incognito.auth_cancelled_count_); |
1008 EXPECT_TRUE(test_server()->Stop()); | 1008 EXPECT_TRUE(test_server()->Stop()); |
1009 } | 1009 } |
1010 | 1010 |
1011 } // namespace | 1011 } // namespace |
OLD | NEW |