OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/browser.h" | 5 #include "chrome/browser/browser.h" |
6 #include "chrome/browser/tab_contents/tab_contents.h" | 6 #include "chrome/browser/tab_contents/tab_contents.h" |
7 #include "chrome/common/chrome_paths.h" | 7 #include "chrome/common/chrome_paths.h" |
8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
9 #include "chrome/common/notification_details.h" | 9 #include "chrome/common/notification_details.h" |
10 #include "chrome/common/notification_observer.h" | 10 #include "chrome/common/notification_observer.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 70 } |
71 } | 71 } |
72 | 72 |
73 private: | 73 private: |
74 NotificationRegistrar registrar_; | 74 NotificationRegistrar registrar_; |
75 }; | 75 }; |
76 | 76 |
77 // Test for crbug.com/12745. This tests that if a download is initiated from | 77 // Test for crbug.com/12745. This tests that if a download is initiated from |
78 // a chrome:// page that has registered and onunload handler, the browser | 78 // a chrome:// page that has registered and onunload handler, the browser |
79 // will be able to close. | 79 // will be able to close. |
80 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, BrowserCloseAfterDownload) { | 80 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, DISABLED_BrowserCloseAfterDown
load) { |
81 GURL downloads_url("chrome://downloads"); | 81 GURL downloads_url("chrome://downloads"); |
82 FilePath zip_download; | 82 FilePath zip_download; |
83 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &zip_download)); | 83 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &zip_download)); |
84 zip_download = zip_download.AppendASCII("zip").AppendASCII("test.zip"); | 84 zip_download = zip_download.AppendASCII("zip").AppendASCII("test.zip"); |
85 ASSERT_TRUE(file_util::PathExists(zip_download)); | 85 ASSERT_TRUE(file_util::PathExists(zip_download)); |
86 GURL zip_url = net::FilePathToFileURL(zip_download); | 86 GURL zip_url = net::FilePathToFileURL(zip_download); |
87 | 87 |
88 ui_test_utils::NavigateToURL(browser(), downloads_url); | 88 ui_test_utils::NavigateToURL(browser(), downloads_url); |
89 TabContents *contents = browser()->GetSelectedTabContents(); | 89 TabContents *contents = browser()->GetSelectedTabContents(); |
90 ASSERT_TRUE(contents); | 90 ASSERT_TRUE(contents); |
91 bool result = false; | 91 bool result = false; |
92 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 92 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
93 contents, | 93 contents, |
94 L"", | 94 L"", |
95 L"window.onunload = function() { var do_nothing = 0; }; " | 95 L"window.onunload = function() { var do_nothing = 0; }; " |
96 L"window.domAutomationController.send(true);", | 96 L"window.domAutomationController.send(true);", |
97 &result)); | 97 &result)); |
98 EXPECT_TRUE(result); | 98 EXPECT_TRUE(result); |
99 ui_test_utils::NavigateToURL(browser(), zip_url); | 99 ui_test_utils::NavigateToURL(browser(), zip_url); |
100 browser()->CloseWindow(); | 100 browser()->CloseWindow(); |
101 BrowserClosedObserver observe(browser()); | 101 BrowserClosedObserver observe(browser()); |
102 } | 102 } |
OLD | NEW |