OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
7 #include "base/prefs/scoped_user_pref_update.h" | 7 #include "base/prefs/scoped_user_pref_update.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 9 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
10 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" | 10 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 | 297 |
298 #if defined(OS_LINUX) || defined(OS_WIN) | 298 #if defined(OS_LINUX) || defined(OS_WIN) |
299 // crbug.com/422868 | 299 // crbug.com/422868 |
300 #define MAYBE_DifferentStorageId DISABLED_DifferentStorageId | 300 #define MAYBE_DifferentStorageId DISABLED_DifferentStorageId |
301 #else | 301 #else |
302 #define MAYBE_DifferentStorageId DifferentStorageId | 302 #define MAYBE_DifferentStorageId DifferentStorageId |
303 #endif | 303 #endif |
304 IN_PROC_BROWSER_TEST_F(InlineLoginUIBrowserTest, MAYBE_DifferentStorageId) { | 304 IN_PROC_BROWSER_TEST_F(InlineLoginUIBrowserTest, MAYBE_DifferentStorageId) { |
305 if (switches::IsEnableWebviewBasedSignin()) { | 305 if (switches::IsEnableWebviewBasedSignin()) { |
306 ContentInfo info = NavigateAndGetInfo( | 306 ContentInfo info = NavigateAndGetInfo( |
307 browser(), | 307 browser(), signin::GetPromoURL( |
308 signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false), | 308 signin_metrics::ACCESS_POINT_START_PAGE, |
| 309 signin_metrics::REASON_SIGNIN_PRIMARY_ACCOUNT, false), |
309 CURRENT_TAB); | 310 CURRENT_TAB); |
310 WaitUntilUIReady(browser()); | 311 WaitUntilUIReady(browser()); |
311 | 312 |
312 // Make sure storage partition of embedded webview is different from | 313 // Make sure storage partition of embedded webview is different from |
313 // parent. | 314 // parent. |
314 std::set<content::WebContents*> set; | 315 std::set<content::WebContents*> set; |
315 GuestViewManager* manager = GuestViewManager::FromBrowserContext( | 316 GuestViewManager* manager = GuestViewManager::FromBrowserContext( |
316 info.contents->GetBrowserContext()); | 317 info.contents->GetBrowserContext()); |
317 manager->ForEachGuest(info.contents, base::Bind(&AddToSet, &set)); | 318 manager->ForEachGuest(info.contents, base::Bind(&AddToSet, &set)); |
318 ASSERT_EQ(1u, set.size()); | 319 ASSERT_EQ(1u, set.size()); |
319 content::WebContents* webview_contents = *set.begin(); | 320 content::WebContents* webview_contents = *set.begin(); |
320 content::RenderProcessHost* process = | 321 content::RenderProcessHost* process = |
321 webview_contents->GetRenderProcessHost(); | 322 webview_contents->GetRenderProcessHost(); |
322 ASSERT_NE(info.pid, process->GetID()); | 323 ASSERT_NE(info.pid, process->GetID()); |
323 ASSERT_NE(info.storage_partition, process->GetStoragePartition()); | 324 ASSERT_NE(info.storage_partition, process->GetStoragePartition()); |
324 } else { | 325 } else { |
325 GURL test_url = ui_test_utils::GetTestUrl( | 326 GURL test_url = ui_test_utils::GetTestUrl( |
326 base::FilePath(base::FilePath::kCurrentDirectory), | 327 base::FilePath(base::FilePath::kCurrentDirectory), |
327 base::FilePath(FILE_PATH_LITERAL("title1.html"))); | 328 base::FilePath(FILE_PATH_LITERAL("title1.html"))); |
328 | 329 |
329 ContentInfo info1 = | 330 ContentInfo info1 = |
330 NavigateAndGetInfo(browser(), test_url, CURRENT_TAB); | 331 NavigateAndGetInfo(browser(), test_url, CURRENT_TAB); |
331 ContentInfo info2 = NavigateAndGetInfo( | 332 ContentInfo info2 = NavigateAndGetInfo( |
332 browser(), | 333 browser(), signin::GetPromoURL( |
333 signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false), | 334 signin_metrics::ACCESS_POINT_START_PAGE, |
| 335 signin_metrics::REASON_SIGNIN_PRIMARY_ACCOUNT, false), |
334 CURRENT_TAB); | 336 CURRENT_TAB); |
335 NavigateAndGetInfo(browser(), test_url, CURRENT_TAB); | 337 NavigateAndGetInfo(browser(), test_url, CURRENT_TAB); |
336 ContentInfo info3 = NavigateAndGetInfo( | 338 ContentInfo info3 = NavigateAndGetInfo( |
337 browser(), | 339 browser(), signin::GetPromoURL( |
338 signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false), | 340 signin_metrics::ACCESS_POINT_START_PAGE, |
| 341 signin_metrics::REASON_SIGNIN_PRIMARY_ACCOUNT, false), |
339 NEW_FOREGROUND_TAB); | 342 NEW_FOREGROUND_TAB); |
340 | 343 |
341 // The info for signin should be the same. | 344 // The info for signin should be the same. |
342 ASSERT_EQ(info2.storage_partition, info3.storage_partition); | 345 ASSERT_EQ(info2.storage_partition, info3.storage_partition); |
343 // The info for test_url and signin should be different. | 346 // The info for test_url and signin should be different. |
344 ASSERT_NE(info1.storage_partition, info2.storage_partition); | 347 ASSERT_NE(info1.storage_partition, info2.storage_partition); |
345 } | 348 } |
346 } | 349 } |
347 | 350 |
348 IN_PROC_BROWSER_TEST_F(InlineLoginUIBrowserTest, OneProcessLimit) { | 351 IN_PROC_BROWSER_TEST_F(InlineLoginUIBrowserTest, OneProcessLimit) { |
349 GURL test_url_1 = ui_test_utils::GetTestUrl( | 352 GURL test_url_1 = ui_test_utils::GetTestUrl( |
350 base::FilePath(base::FilePath::kCurrentDirectory), | 353 base::FilePath(base::FilePath::kCurrentDirectory), |
351 base::FilePath(FILE_PATH_LITERAL("title1.html"))); | 354 base::FilePath(FILE_PATH_LITERAL("title1.html"))); |
352 GURL test_url_2 = ui_test_utils::GetTestUrl( | 355 GURL test_url_2 = ui_test_utils::GetTestUrl( |
353 base::FilePath(base::FilePath::kCurrentDirectory), | 356 base::FilePath(base::FilePath::kCurrentDirectory), |
354 base::FilePath(FILE_PATH_LITERAL("data:text/html,Hello world!"))); | 357 base::FilePath(FILE_PATH_LITERAL("data:text/html,Hello world!"))); |
355 | 358 |
356 // Even when the process limit is set to one, the signin process should | 359 // Even when the process limit is set to one, the signin process should |
357 // still be given its own process and storage partition. | 360 // still be given its own process and storage partition. |
358 content::RenderProcessHost::SetMaxRendererProcessCount(1); | 361 content::RenderProcessHost::SetMaxRendererProcessCount(1); |
359 | 362 |
360 ContentInfo info1 = | 363 ContentInfo info1 = |
361 NavigateAndGetInfo(browser(), test_url_1, CURRENT_TAB); | 364 NavigateAndGetInfo(browser(), test_url_1, CURRENT_TAB); |
362 ContentInfo info2 = | 365 ContentInfo info2 = |
363 NavigateAndGetInfo(browser(), test_url_2, CURRENT_TAB); | 366 NavigateAndGetInfo(browser(), test_url_2, CURRENT_TAB); |
364 ContentInfo info3 = NavigateAndGetInfo( | 367 ContentInfo info3 = NavigateAndGetInfo( |
365 browser(), | 368 browser(), |
366 signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false), | 369 signin::GetPromoURL(signin_metrics::ACCESS_POINT_START_PAGE, |
| 370 signin_metrics::REASON_SIGNIN_PRIMARY_ACCOUNT, false), |
367 CURRENT_TAB); | 371 CURRENT_TAB); |
368 | 372 |
369 ASSERT_EQ(info1.pid, info2.pid); | 373 ASSERT_EQ(info1.pid, info2.pid); |
370 ASSERT_NE(info1.pid, info3.pid); | 374 ASSERT_NE(info1.pid, info3.pid); |
371 } | 375 } |
372 | 376 |
373 #if !defined(OS_CHROMEOS) | 377 #if !defined(OS_CHROMEOS) |
374 | 378 |
375 IN_PROC_BROWSER_TEST_F(InlineLoginUIBrowserTest, CanOfferNoProfile) { | 379 IN_PROC_BROWSER_TEST_F(InlineLoginUIBrowserTest, CanOfferNoProfile) { |
376 std::string error_message; | 380 std::string error_message; |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 SimulateStartAuthCodeForOAuth2TokenExchangeSuccess( | 584 SimulateStartAuthCodeForOAuth2TokenExchangeSuccess( |
581 "{\"access_token\": \"access_token\", \"expires_in\": 1234567890," | 585 "{\"access_token\": \"access_token\", \"expires_in\": 1234567890," |
582 " \"refresh_token\": \"refresh_token\"}"); | 586 " \"refresh_token\": \"refresh_token\"}"); |
583 } | 587 } |
584 | 588 |
585 // Test signin helper creates sync starter with correct confirmation when | 589 // Test signin helper creates sync starter with correct confirmation when |
586 // signing in with default sync options. | 590 // signing in with default sync options. |
587 IN_PROC_BROWSER_TEST_F(InlineLoginHelperBrowserTest, | 591 IN_PROC_BROWSER_TEST_F(InlineLoginHelperBrowserTest, |
588 SigninCreatesSyncStarter1) { | 592 SigninCreatesSyncStarter1) { |
589 // See Source enum in components/signin/core/browser/signin_metrics.h for | 593 // See Source enum in components/signin/core/browser/signin_metrics.h for |
590 // possible values of source=. | 594 // possible values of access_point=, reason=. |
591 GURL url("chrome://chrome-signin/?source=0"); | 595 GURL url("chrome://chrome-signin/?access_point=0&reason=0"); |
592 base::WeakPtr<InlineLoginHandlerImpl> handler; | 596 base::WeakPtr<InlineLoginHandlerImpl> handler; |
593 // MockSyncStarterInlineSigninHelper will delete itself when done using | 597 // MockSyncStarterInlineSigninHelper will delete itself when done using |
594 // base::ThreadTaskRunnerHandle::DeleteSoon(), so need to delete here. But | 598 // base::ThreadTaskRunnerHandle::DeleteSoon(), so need to delete here. But |
595 // do need the RunUntilIdle() at the end. | 599 // do need the RunUntilIdle() at the end. |
596 MockSyncStarterInlineSigninHelper* helper = | 600 MockSyncStarterInlineSigninHelper* helper = |
597 new MockSyncStarterInlineSigninHelper( | 601 new MockSyncStarterInlineSigninHelper( |
598 handler, | 602 handler, |
599 browser()->profile()->GetRequestContext(), | 603 browser()->profile()->GetRequestContext(), |
600 browser()->profile(), | 604 browser()->profile(), |
601 url, | 605 url, |
(...skipping 12 matching lines...) Expand all Loading... |
614 | 618 |
615 SimulateOnClientOAuthSuccess(helper, "refresh_token"); | 619 SimulateOnClientOAuthSuccess(helper, "refresh_token"); |
616 base::MessageLoop::current()->RunUntilIdle(); | 620 base::MessageLoop::current()->RunUntilIdle(); |
617 } | 621 } |
618 | 622 |
619 // Test signin helper creates sync starter with correct confirmation when | 623 // Test signin helper creates sync starter with correct confirmation when |
620 // signing in and choosing what to sync first. | 624 // signing in and choosing what to sync first. |
621 IN_PROC_BROWSER_TEST_F(InlineLoginHelperBrowserTest, | 625 IN_PROC_BROWSER_TEST_F(InlineLoginHelperBrowserTest, |
622 SigninCreatesSyncStarter2) { | 626 SigninCreatesSyncStarter2) { |
623 // See Source enum in components/signin/core/browser/signin_metrics.h for | 627 // See Source enum in components/signin/core/browser/signin_metrics.h for |
624 // possible values of source=. | 628 // possible values of access_point=, reason=. |
625 const GURL url("chrome://chrome-signin/?source=0"); | 629 const GURL url("chrome://chrome-signin/?access_point=0&reason=0"); |
626 base::WeakPtr<InlineLoginHandlerImpl> handler; | 630 base::WeakPtr<InlineLoginHandlerImpl> handler; |
627 // MockSyncStarterInlineSigninHelper will delete itself when done using | 631 // MockSyncStarterInlineSigninHelper will delete itself when done using |
628 // base::ThreadTaskRunnerHandle::DeleteSoon(), so need to delete here. But | 632 // base::ThreadTaskRunnerHandle::DeleteSoon(), so need to delete here. But |
629 // do need the RunUntilIdle() at the end. | 633 // do need the RunUntilIdle() at the end. |
630 MockSyncStarterInlineSigninHelper* helper = | 634 MockSyncStarterInlineSigninHelper* helper = |
631 new MockSyncStarterInlineSigninHelper( | 635 new MockSyncStarterInlineSigninHelper( |
632 handler, | 636 handler, |
633 browser()->profile()->GetRequestContext(), | 637 browser()->profile()->GetRequestContext(), |
634 browser()->profile(), | 638 browser()->profile(), |
635 url, | 639 url, |
(...skipping 12 matching lines...) Expand all Loading... |
648 | 652 |
649 SimulateOnClientOAuthSuccess(helper, "refresh_token"); | 653 SimulateOnClientOAuthSuccess(helper, "refresh_token"); |
650 base::MessageLoop::current()->RunUntilIdle(); | 654 base::MessageLoop::current()->RunUntilIdle(); |
651 } | 655 } |
652 | 656 |
653 // Test signin helper creates sync starter with correct confirmation when | 657 // Test signin helper creates sync starter with correct confirmation when |
654 // signing in with an untrusted sign occurs. | 658 // signing in with an untrusted sign occurs. |
655 IN_PROC_BROWSER_TEST_F(InlineLoginHelperBrowserTest, | 659 IN_PROC_BROWSER_TEST_F(InlineLoginHelperBrowserTest, |
656 SigninCreatesSyncStarter3) { | 660 SigninCreatesSyncStarter3) { |
657 // See Source enum in components/signin/core/browser/signin_metrics.h for | 661 // See Source enum in components/signin/core/browser/signin_metrics.h for |
658 // possible values of source=. | 662 // possible values of access_point=, reason=. |
659 GURL url("chrome://chrome-signin/?source=0"); | 663 GURL url("chrome://chrome-signin/?access_point=0&reason=0"); |
660 base::WeakPtr<InlineLoginHandlerImpl> handler; | 664 base::WeakPtr<InlineLoginHandlerImpl> handler; |
661 // MockSyncStarterInlineSigninHelper will delete itself when done using | 665 // MockSyncStarterInlineSigninHelper will delete itself when done using |
662 // base::ThreadTaskRunnerHandle::DeleteSoon(), so need to delete here. But | 666 // base::ThreadTaskRunnerHandle::DeleteSoon(), so need to delete here. But |
663 // do need the RunUntilIdle() at the end. | 667 // do need the RunUntilIdle() at the end. |
664 MockSyncStarterInlineSigninHelper* helper = | 668 MockSyncStarterInlineSigninHelper* helper = |
665 new MockSyncStarterInlineSigninHelper( | 669 new MockSyncStarterInlineSigninHelper( |
666 handler, | 670 handler, |
667 browser()->profile()->GetRequestContext(), | 671 browser()->profile()->GetRequestContext(), |
668 browser()->profile(), | 672 browser()->profile(), |
669 url, | 673 url, |
(...skipping 12 matching lines...) Expand all Loading... |
682 | 686 |
683 SimulateOnClientOAuthSuccess(helper, "refresh_token"); | 687 SimulateOnClientOAuthSuccess(helper, "refresh_token"); |
684 base::MessageLoop::current()->RunUntilIdle(); | 688 base::MessageLoop::current()->RunUntilIdle(); |
685 } | 689 } |
686 | 690 |
687 // Test signin helper creates sync starter with correct confirmation during | 691 // Test signin helper creates sync starter with correct confirmation during |
688 // re-auth. | 692 // re-auth. |
689 IN_PROC_BROWSER_TEST_F(InlineLoginHelperBrowserTest, | 693 IN_PROC_BROWSER_TEST_F(InlineLoginHelperBrowserTest, |
690 SigninCreatesSyncStarter4) { | 694 SigninCreatesSyncStarter4) { |
691 // See Source enum in components/signin/core/browser/signin_metrics.h for | 695 // See Source enum in components/signin/core/browser/signin_metrics.h for |
692 // possible values of source=. | 696 // possible values of access_point=, reason=. |
693 const GURL url("chrome://chrome-signin/?source=3"); | 697 const GURL url("chrome://chrome-signin/?access_point=3&reason=0"); |
694 base::WeakPtr<InlineLoginHandlerImpl> handler; | 698 base::WeakPtr<InlineLoginHandlerImpl> handler; |
695 // MockSyncStarterInlineSigninHelper will delete itself when done using | 699 // MockSyncStarterInlineSigninHelper will delete itself when done using |
696 // base::ThreadTaskRunnerHandle::DeleteSoon(), so need to delete here. But | 700 // base::ThreadTaskRunnerHandle::DeleteSoon(), so need to delete here. But |
697 // do need the RunUntilIdle() at the end. | 701 // do need the RunUntilIdle() at the end. |
698 MockSyncStarterInlineSigninHelper* helper = | 702 MockSyncStarterInlineSigninHelper* helper = |
699 new MockSyncStarterInlineSigninHelper( | 703 new MockSyncStarterInlineSigninHelper( |
700 handler, | 704 handler, |
701 browser()->profile()->GetRequestContext(), | 705 browser()->profile()->GetRequestContext(), |
702 browser()->profile(), | 706 browser()->profile(), |
703 url, | 707 url, |
(...skipping 16 matching lines...) Expand all Loading... |
720 SimulateOnClientOAuthSuccess(helper, "refresh_token"); | 724 SimulateOnClientOAuthSuccess(helper, "refresh_token"); |
721 base::MessageLoop::current()->RunUntilIdle(); | 725 base::MessageLoop::current()->RunUntilIdle(); |
722 } | 726 } |
723 | 727 |
724 // Test signin helper does not create sync starter when reauthenticating. | 728 // Test signin helper does not create sync starter when reauthenticating. |
725 IN_PROC_BROWSER_TEST_F(InlineLoginHelperBrowserTest, | 729 IN_PROC_BROWSER_TEST_F(InlineLoginHelperBrowserTest, |
726 ReauthCallsUpdateCredentials) { | 730 ReauthCallsUpdateCredentials) { |
727 ASSERT_EQ(0ul, token_service()->GetAccounts().size()); | 731 ASSERT_EQ(0ul, token_service()->GetAccounts().size()); |
728 | 732 |
729 // See Source enum in components/signin/core/browser/signin_metrics.h for | 733 // See Source enum in components/signin/core/browser/signin_metrics.h for |
730 // possible values of source=. | 734 // possible values of access_point=, reason=. |
731 GURL url("chrome://chrome-signin/?source=11"); | 735 GURL url("chrome://chrome-signin/?access_point=3&reason=2"); |
732 base::WeakPtr<InlineLoginHandlerImpl> handler; | 736 base::WeakPtr<InlineLoginHandlerImpl> handler; |
733 InlineSigninHelper helper(handler, | 737 InlineSigninHelper helper(handler, |
734 browser()->profile()->GetRequestContext(), | 738 browser()->profile()->GetRequestContext(), |
735 browser()->profile(), | 739 browser()->profile(), |
736 url, | 740 url, |
737 "foo@gmail.com", | 741 "foo@gmail.com", |
738 "gaiaid-12345", | 742 "gaiaid-12345", |
739 "password", | 743 "password", |
740 "", // session index | 744 "", // session index |
741 "auth_code", // auth code | 745 "auth_code", // auth code |
742 std::string(), | 746 std::string(), |
743 false, // choose what to sync | 747 false, // choose what to sync |
744 false); // confirm untrusted signin | 748 false); // confirm untrusted signin |
745 SimulateOnClientOAuthSuccess(&helper, "refresh_token"); | 749 SimulateOnClientOAuthSuccess(&helper, "refresh_token"); |
746 ASSERT_EQ(1ul, token_service()->GetAccounts().size()); | 750 ASSERT_EQ(1ul, token_service()->GetAccounts().size()); |
747 base::MessageLoop::current()->RunUntilIdle(); | 751 base::MessageLoop::current()->RunUntilIdle(); |
748 } | 752 } |
749 | 753 |
750 // Test signin helper does not create sync starter when adding another account | 754 // Test signin helper does not create sync starter when adding another account |
751 // to profile. | 755 // to profile. |
752 IN_PROC_BROWSER_TEST_F(InlineLoginHelperBrowserTest, | 756 IN_PROC_BROWSER_TEST_F(InlineLoginHelperBrowserTest, |
753 AddAccountsCallsUpdateCredentials) { | 757 AddAccountsCallsUpdateCredentials) { |
754 ASSERT_EQ(0ul, token_service()->GetAccounts().size()); | 758 ASSERT_EQ(0ul, token_service()->GetAccounts().size()); |
755 | 759 |
756 // See Source enum in components/signin/core/browser/signin_metrics.h for | 760 // See Source enum in components/signin/core/browser/signin_metrics.h for |
757 // possible values of source=. | 761 // possible values of access_point=, reason=. |
758 GURL url("chrome://chrome-signin/?source=9"); | 762 GURL url("chrome://chrome-signin/?access_point=10&reason=1"); |
759 base::WeakPtr<InlineLoginHandlerImpl> handler; | 763 base::WeakPtr<InlineLoginHandlerImpl> handler; |
760 InlineSigninHelper helper(handler, | 764 InlineSigninHelper helper(handler, |
761 browser()->profile()->GetRequestContext(), | 765 browser()->profile()->GetRequestContext(), |
762 browser()->profile(), | 766 browser()->profile(), |
763 url, | 767 url, |
764 "foo@gmail.com", | 768 "foo@gmail.com", |
765 "gaiaid-12345", | 769 "gaiaid-12345", |
766 "password", | 770 "password", |
767 "", // session index | 771 "", // session index |
768 "auth_code", // auth code | 772 "auth_code", // auth code |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest, Basic) { | 829 IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest, Basic) { |
826 const GURL kUrl(kFooWebUIURL); | 830 const GURL kUrl(kFooWebUIURL); |
827 EXPECT_CALL(foo_provider(), NewWebUI(_, ::testing::Eq(kUrl))) | 831 EXPECT_CALL(foo_provider(), NewWebUI(_, ::testing::Eq(kUrl))) |
828 .WillOnce(ReturnNewWebUI()); | 832 .WillOnce(ReturnNewWebUI()); |
829 ui_test_utils::NavigateToURL(browser(), GURL(kFooWebUIURL)); | 833 ui_test_utils::NavigateToURL(browser(), GURL(kFooWebUIURL)); |
830 } | 834 } |
831 | 835 |
832 // Make sure that the foo webui handler does not get created when we try to | 836 // Make sure that the foo webui handler does not get created when we try to |
833 // load it inside the iframe of the login ui. | 837 // load it inside the iframe of the login ui. |
834 IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest, NoWebUIInIframe) { | 838 IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest, NoWebUIInIframe) { |
835 GURL url = signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false). | 839 GURL url = |
836 Resolve("?source=0&frameUrl=chrome://foo"); | 840 signin::GetPromoURL(signin_metrics::ACCESS_POINT_START_PAGE, |
| 841 signin_metrics::REASON_SIGNIN_PRIMARY_ACCOUNT, false) |
| 842 .Resolve("?source=0&access_point=0&reason=0&frameUrl=chrome://foo"); |
837 EXPECT_CALL(foo_provider(), NewWebUI(_, _)).Times(0); | 843 EXPECT_CALL(foo_provider(), NewWebUI(_, _)).Times(0); |
838 ui_test_utils::NavigateToURL(browser(), url); | 844 ui_test_utils::NavigateToURL(browser(), url); |
839 } | 845 } |
840 | 846 |
841 // Flaky on CrOS, http://crbug.com/364759. | 847 // Flaky on CrOS, http://crbug.com/364759. |
842 #if defined(OS_CHROMEOS) | 848 #if defined(OS_CHROMEOS) |
843 #define MAYBE_TopFrameNavigationDisallowed DISABLED_TopFrameNavigationDisallowed | 849 #define MAYBE_TopFrameNavigationDisallowed DISABLED_TopFrameNavigationDisallowed |
844 #else | 850 #else |
845 #define MAYBE_TopFrameNavigationDisallowed TopFrameNavigationDisallowed | 851 #define MAYBE_TopFrameNavigationDisallowed TopFrameNavigationDisallowed |
846 #endif | 852 #endif |
847 | 853 |
848 // Make sure that the gaia iframe cannot trigger top-frame navigation. | 854 // Make sure that the gaia iframe cannot trigger top-frame navigation. |
849 // TODO(guohui): flaky on trybot crbug/364759. | 855 // TODO(guohui): flaky on trybot crbug/364759. |
850 IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest, | 856 IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest, |
851 MAYBE_TopFrameNavigationDisallowed) { | 857 MAYBE_TopFrameNavigationDisallowed) { |
852 // Loads into gaia iframe a web page that attempts to deframe on load. | 858 // Loads into gaia iframe a web page that attempts to deframe on load. |
853 GURL deframe_url(embedded_test_server()->GetURL("/login/deframe.html")); | 859 GURL deframe_url(embedded_test_server()->GetURL("/login/deframe.html")); |
854 GURL url(net::AppendOrReplaceQueryParameter( | 860 GURL url(net::AppendOrReplaceQueryParameter( |
855 signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false), | 861 signin::GetPromoURL(signin_metrics::ACCESS_POINT_START_PAGE, |
| 862 signin_metrics::REASON_SIGNIN_PRIMARY_ACCOUNT, false), |
856 "frameUrl", deframe_url.spec())); | 863 "frameUrl", deframe_url.spec())); |
857 ui_test_utils::NavigateToURL(browser(), url); | 864 ui_test_utils::NavigateToURL(browser(), url); |
858 WaitUntilUIReady(browser()); | 865 WaitUntilUIReady(browser()); |
859 | 866 |
860 content::WebContents* contents = | 867 content::WebContents* contents = |
861 browser()->tab_strip_model()->GetActiveWebContents(); | 868 browser()->tab_strip_model()->GetActiveWebContents(); |
862 EXPECT_EQ(url, contents->GetVisibleURL()); | 869 EXPECT_EQ(url, contents->GetVisibleURL()); |
863 | 870 |
864 content::NavigationController& controller = contents->GetController(); | 871 content::NavigationController& controller = contents->GetController(); |
865 EXPECT_TRUE(controller.GetPendingEntry() == NULL); | 872 EXPECT_TRUE(controller.GetPendingEntry() == NULL); |
866 } | 873 } |
867 | 874 |
868 // Flaky on CrOS, http://crbug.com/364759. | 875 // Flaky on CrOS, http://crbug.com/364759. |
869 // Also flaky on Mac, http://crbug.com/442674. | 876 // Also flaky on Mac, http://crbug.com/442674. |
870 // Also flaky on Linux which is just too flaky | 877 // Also flaky on Linux which is just too flaky |
871 IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest, | 878 IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest, |
872 DISABLED_NavigationToOtherChromeURLDisallowed) { | 879 DISABLED_NavigationToOtherChromeURLDisallowed) { |
873 ui_test_utils::NavigateToURL( | 880 ui_test_utils::NavigateToURL( |
874 browser(), signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false)); | 881 browser(), signin::GetPromoURL( |
| 882 signin_metrics::ACCESS_POINT_START_PAGE, |
| 883 signin_metrics::REASON_SIGNIN_PRIMARY_ACCOUNT, false)); |
875 WaitUntilUIReady(browser()); | 884 WaitUntilUIReady(browser()); |
876 | 885 |
877 content::WebContents* contents = | 886 content::WebContents* contents = |
878 browser()->tab_strip_model()->GetActiveWebContents(); | 887 browser()->tab_strip_model()->GetActiveWebContents(); |
879 ASSERT_TRUE(content::ExecuteScript( | 888 ASSERT_TRUE(content::ExecuteScript( |
880 contents, "window.location.href = 'chrome://foo'")); | 889 contents, "window.location.href = 'chrome://foo'")); |
881 | 890 |
882 content::TestNavigationObserver navigation_observer(contents, 1); | 891 content::TestNavigationObserver navigation_observer(contents, 1); |
883 navigation_observer.Wait(); | 892 navigation_observer.Wait(); |
884 | 893 |
885 EXPECT_EQ(GURL("about:blank"), contents->GetVisibleURL()); | 894 EXPECT_EQ(GURL("about:blank"), contents->GetVisibleURL()); |
886 } | 895 } |
887 | 896 |
888 #if !defined(OS_CHROMEOS) | 897 #if !defined(OS_CHROMEOS) |
889 IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest, | 898 IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest, |
890 ConfirmationRequiredForNonsecureSignin) { | 899 ConfirmationRequiredForNonsecureSignin) { |
891 FakeGaia fake_gaia; | 900 FakeGaia fake_gaia; |
892 fake_gaia.Initialize(); | 901 fake_gaia.Initialize(); |
893 | 902 |
894 embedded_test_server()->RegisterRequestHandler( | 903 embedded_test_server()->RegisterRequestHandler( |
895 base::Bind(&FakeGaia::HandleRequest, | 904 base::Bind(&FakeGaia::HandleRequest, |
896 base::Unretained(&fake_gaia))); | 905 base::Unretained(&fake_gaia))); |
897 fake_gaia.SetFakeMergeSessionParams( | 906 fake_gaia.SetFakeMergeSessionParams( |
898 "email@gmail.com", "fake-sid-cookie", "fake-lsid-cookie"); | 907 "email@gmail.com", "fake-sid-cookie", "fake-lsid-cookie"); |
899 | 908 |
900 // Navigates to the Chrome signin page which loads the fake gaia auth page. | 909 // Navigates to the Chrome signin page which loads the fake gaia auth page. |
901 // Since the fake gaia auth page is served over HTTP, thus expects to see an | 910 // Since the fake gaia auth page is served over HTTP, thus expects to see an |
902 // untrusted signin confirmation dialog upon submitting credentials below. | 911 // untrusted signin confirmation dialog upon submitting credentials below. |
903 ui_test_utils::NavigateToURL( | 912 ui_test_utils::NavigateToURL( |
904 browser(), signin::GetPromoURL(signin_metrics::SOURCE_START_PAGE, false)); | 913 browser(), signin::GetPromoURL( |
| 914 signin_metrics::ACCESS_POINT_START_PAGE, |
| 915 signin_metrics::REASON_SIGNIN_PRIMARY_ACCOUNT, false)); |
905 WaitUntilUIReady(browser()); | 916 WaitUntilUIReady(browser()); |
906 | 917 |
907 MockLoginUIObserver observer; | 918 MockLoginUIObserver observer; |
908 LoginUIServiceFactory::GetForProfile(browser()->profile()) | 919 LoginUIServiceFactory::GetForProfile(browser()->profile()) |
909 ->AddObserver(&observer); | 920 ->AddObserver(&observer); |
910 base::RunLoop run_loop; | 921 base::RunLoop run_loop; |
911 EXPECT_CALL(observer, OnUntrustedLoginUIShown()) | 922 EXPECT_CALL(observer, OnUntrustedLoginUIShown()) |
912 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); | 923 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
913 | 924 |
914 ExecuteJsToSigninInSigninFrame(browser(), "email@gmail.com", "password"); | 925 ExecuteJsToSigninInSigninFrame(browser(), "email@gmail.com", "password"); |
915 run_loop.Run(); | 926 run_loop.Run(); |
916 base::MessageLoop::current()->RunUntilIdle(); | 927 base::MessageLoop::current()->RunUntilIdle(); |
917 } | 928 } |
918 #endif // OS_CHROMEOS | 929 #endif // OS_CHROMEOS |
OLD | NEW |