Chromium Code Reviews| 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( | |
|
xiyuan
2017/04/27 15:55:45
I don't think this waits for 'loadcommit' handler
msarda
2017/04/27 15:59:39
It does wait to get a response message in the cont
xiyuan
2017/04/27 16:16:24
Okay. At least, we should add an ASSERT_EQ to guar
Charlie Reis
2017/04/27 16:26:33
Agreed-- no need to loop, but verifying the right
msarda
2017/04/27 16:48:51
Done (I had it locally and I think I removed that
| |
| 891 browser()->tab_strip_model()->GetActiveWebContents(), script, &message)); | |
| 892 } | |
| 893 | |
| 868 // Make sure that the gaia iframe cannot trigger top-frame navigation. | 894 // Make sure that the gaia iframe cannot trigger top-frame navigation. |
| 869 // TODO(guohui): flaky on trybot crbug/364759. | 895 // TODO(guohui): flaky on trybot crbug/364759. |
| 870 IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest, | 896 IN_PROC_BROWSER_TEST_F(InlineLoginUISafeIframeBrowserTest, |
| 871 TopFrameNavigationDisallowed) { | 897 TopFrameNavigationDisallowed) { |
| 872 // Loads into gaia iframe a web page that attempts to deframe on load. | 898 // Loads into gaia iframe a web page that attempts to deframe on load. |
| 873 GURL deframe_url(embedded_test_server()->GetURL("/login/deframe.html")); | 899 GURL deframe_url(embedded_test_server()->GetURL("/login/deframe.html")); |
| 874 GURL url(net::AppendOrReplaceQueryParameter(GetSigninPromoURL(), "frameUrl", | 900 GURL url(net::AppendOrReplaceQueryParameter(GetSigninPromoURL(), "frameUrl", |
| 875 deframe_url.spec())); | 901 deframe_url.spec())); |
| 876 ui_test_utils::NavigateToURL(browser(), url); | 902 ui_test_utils::NavigateToURL(browser(), url); |
| 877 WaitUntilUIReady(browser()); | 903 WaitUntilUIReady(browser()); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 895 content::WebContents* contents = | 921 content::WebContents* contents = |
| 896 browser()->tab_strip_model()->GetActiveWebContents(); | 922 browser()->tab_strip_model()->GetActiveWebContents(); |
| 897 ASSERT_TRUE(content::ExecuteScript( | 923 ASSERT_TRUE(content::ExecuteScript( |
| 898 contents, "window.location.href = 'chrome://foo'")); | 924 contents, "window.location.href = 'chrome://foo'")); |
| 899 | 925 |
| 900 content::TestNavigationObserver navigation_observer(contents, 1); | 926 content::TestNavigationObserver navigation_observer(contents, 1); |
| 901 navigation_observer.Wait(); | 927 navigation_observer.Wait(); |
| 902 | 928 |
| 903 EXPECT_EQ(GURL("about:blank"), contents->GetVisibleURL()); | 929 EXPECT_EQ(GURL("about:blank"), contents->GetVisibleURL()); |
| 904 } | 930 } |
| OLD | NEW |