OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
10 #include "base/test/thread_test_helper.h" | 10 #include "base/test/thread_test_helper.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/test/base/in_process_browser_test.h" | 13 #include "chrome/test/base/in_process_browser_test.h" |
14 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
15 #include "chrome/test/base/ui_test_utils.h" | 15 #include "chrome/test/base/ui_test_utils.h" |
16 #include "content/browser/tab_contents/tab_contents.h" | 16 #include "content/public/browser/web_contents.h" |
17 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
18 | 18 |
19 class MagicIframeBrowserTest : public InProcessBrowserTest { | 19 class MagicIframeBrowserTest : public InProcessBrowserTest { |
20 public: | 20 public: |
21 MagicIframeBrowserTest() { | 21 MagicIframeBrowserTest() { |
22 EnableDOMAutomation(); | 22 EnableDOMAutomation(); |
23 } | 23 } |
24 | 24 |
25 GURL GetTestURL(const std::string& path); | 25 GURL GetTestURL(const std::string& path); |
26 }; | 26 }; |
27 | 27 |
28 GURL MagicIframeBrowserTest::GetTestURL(const std::string& path) { | 28 GURL MagicIframeBrowserTest::GetTestURL(const std::string& path) { |
29 std::string url_path = "files/magic_iframe/"; | 29 std::string url_path = "files/magic_iframe/"; |
30 url_path.append(path); | 30 url_path.append(path); |
31 return test_server()->GetURL(url_path); | 31 return test_server()->GetURL(url_path); |
32 } | 32 } |
33 | 33 |
34 // Verifies that reparenting of iframe between different pages works as | 34 // Verifies that reparenting of iframe between different pages works as |
35 // expected, including smooth transfer of resources that are still being loaded. | 35 // expected, including smooth transfer of resources that are still being loaded. |
36 // The test failure manifests as the ongoing XHR request is not finishing | 36 // The test failure manifests as the ongoing XHR request is not finishing |
37 // (silently aborted) when the test iframe is transferred between pages (and | 37 // (silently aborted) when the test iframe is transferred between pages (and |
38 // the original page closes). This causes the final navigation to not complete | 38 // the original page closes). This causes the final navigation to not complete |
39 // and test terminated due to a timeout. | 39 // and test terminated due to a timeout. |
40 IN_PROC_BROWSER_TEST_F(MagicIframeBrowserTest, TransferIframeCloseWindow) { | 40 IN_PROC_BROWSER_TEST_F(MagicIframeBrowserTest, TransferIframeCloseWindow) { |
41 ASSERT_TRUE(test_server()->Start()); | 41 ASSERT_TRUE(test_server()->Start()); |
42 GURL url(GetTestURL("iframe-reparenting-close-window.html")); | 42 GURL url(GetTestURL("iframe-reparenting-close-window.html")); |
43 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 3); | 43 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 3); |
44 std::string result; | 44 std::string result; |
45 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( | 45 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( |
46 browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", | 46 browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", |
47 L"window.domAutomationController.send(getLog())", &result)); | 47 L"window.domAutomationController.send(getLog())", &result)); |
48 ASSERT_NE(result.find("DONE"), std::string::npos) << result; | 48 ASSERT_NE(result.find("DONE"), std::string::npos) << result; |
49 } | 49 } |
50 | 50 |
OLD | NEW |