| 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/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 | 858 |
| 859 // Make sure that the foo webui handler does not get created when we try to | 859 // Make sure that the foo webui handler does not get created when we try to |
| 860 // load it inside the iframe of the login ui. | 860 // load it inside the iframe of the login ui. |
| 861 IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest, NoWebUIInIframe) { | 861 IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest, NoWebUIInIframe) { |
| 862 GURL url = GetSigninPromoURL().Resolve( | 862 GURL url = GetSigninPromoURL().Resolve( |
| 863 "?source=0&access_point=0&reason=0&frameUrl=chrome://foo"); | 863 "?source=0&access_point=0&reason=0&frameUrl=chrome://foo"); |
| 864 EXPECT_CALL(foo_provider(), NewWebUI(_, _)).Times(0); | 864 EXPECT_CALL(foo_provider(), NewWebUI(_, _)).Times(0); |
| 865 ui_test_utils::NavigateToURL(browser(), url); | 865 ui_test_utils::NavigateToURL(browser(), url); |
| 866 } | 866 } |
| 867 | 867 |
| 868 // Make sure that "success.html" can be loaded by chrome://chrome-signin. |
| 869 // http://crbug.com/709117 |
| 870 IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest, |
| 871 LoadSuccessContinueURL) { |
| 872 ui_test_utils::NavigateToURL(browser(), GetSigninPromoURL()); |
| 873 WaitUntilUIReady(browser()); |
| 874 |
| 875 const std::string success_url = |
| 876 GaiaUrls::GetInstance()->signin_completed_continue_url().spec(); |
| 877 const char* kLoadSuccessPageScript = |
| 878 "var handler = function(e) {" |
| 879 " if (e.url == '%s') {" |
| 880 " window.domAutomationController.send('success_page_loaded');" |
| 881 " }" |
| 882 "};" |
| 883 "var extension_webview = inline.login.getAuthExtHost().webview_;" |
| 884 "extension_webview.addEventListener('loadcommit', handler);" |
| 885 "extension_webview.src = '%s';"; |
| 886 std::string script = base::StringPrintf( |
| 887 kLoadSuccessPageScript, success_url.c_str(), success_url.c_str()); |
| 888 |
| 889 std::string message; |
| 890 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
| 891 browser()->tab_strip_model()->GetActiveWebContents(), script, &message)); |
| 892 EXPECT_EQ("success_page_loaded", message); |
| 893 } |
| 894 |
| 868 // Make sure that the gaia iframe cannot trigger top-frame navigation. | 895 // Make sure that the gaia iframe cannot trigger top-frame navigation. |
| 869 // TODO(guohui): flaky on trybot crbug/364759. | 896 // TODO(guohui): flaky on trybot crbug/364759. |
| 870 IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest, | 897 IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest, |
| 871 TopFrameNavigationDisallowed) { | 898 TopFrameNavigationDisallowed) { |
| 872 // Loads into gaia iframe a web page that attempts to deframe on load. | 899 // Loads into gaia iframe a web page that attempts to deframe on load. |
| 873 GURL deframe_url(embedded_test_server()->GetURL("/login/deframe.html")); | 900 GURL deframe_url(embedded_test_server()->GetURL("/login/deframe.html")); |
| 874 GURL url(net::AppendOrReplaceQueryParameter(GetSigninPromoURL(), "frameUrl", | 901 GURL url(net::AppendOrReplaceQueryParameter(GetSigninPromoURL(), "frameUrl", |
| 875 deframe_url.spec())); | 902 deframe_url.spec())); |
| 876 ui_test_utils::NavigateToURL(browser(), url); | 903 ui_test_utils::NavigateToURL(browser(), url); |
| 877 WaitUntilUIReady(browser()); | 904 WaitUntilUIReady(browser()); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 895 content::WebContents* contents = | 922 content::WebContents* contents = |
| 896 browser()->tab_strip_model()->GetActiveWebContents(); | 923 browser()->tab_strip_model()->GetActiveWebContents(); |
| 897 ASSERT_TRUE(content::ExecuteScript( | 924 ASSERT_TRUE(content::ExecuteScript( |
| 898 contents, "window.location.href = 'chrome://foo'")); | 925 contents, "window.location.href = 'chrome://foo'")); |
| 899 | 926 |
| 900 content::TestNavigationObserver navigation_observer(contents, 1); | 927 content::TestNavigationObserver navigation_observer(contents, 1); |
| 901 navigation_observer.Wait(); | 928 navigation_observer.Wait(); |
| 902 | 929 |
| 903 EXPECT_EQ(GURL("about:blank"), contents->GetVisibleURL()); | 930 EXPECT_EQ(GURL("about:blank"), contents->GetVisibleURL()); |
| 904 } | 931 } |
| OLD | NEW |