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/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_temp_dir.h" | 8 #include "base/memory/scoped_temp_dir.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/test/test_file_util.h" | 10 #include "base/test/test_file_util.h" |
(...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1313 contents->render_view_host(), | 1313 contents->render_view_host(), |
1314 L"", | 1314 L"", |
1315 L"window.domAutomationController.send(window.webui_responded_);", | 1315 L"window.domAutomationController.send(window.webui_responded_);", |
1316 &webui_responded)); | 1316 &webui_responded)); |
1317 EXPECT_TRUE(webui_responded); | 1317 EXPECT_TRUE(webui_responded); |
1318 } | 1318 } |
1319 | 1319 |
1320 // Test for crbug.com/12745. This tests that if a download is initiated from | 1320 // Test for crbug.com/12745. This tests that if a download is initiated from |
1321 // a chrome:// page that has registered and onunload handler, the browser | 1321 // a chrome:// page that has registered and onunload handler, the browser |
1322 // will be able to close. | 1322 // will be able to close. |
1323 // Fails on Windows and Linux. http://crbug.com/82278 | 1323 // After several correct executions, this test starts failing on the build |
1324 #if defined(OS_WIN) || defined(OS_LINUX) | 1324 // bots and then continues to fail consistently. http://crbug.com/82278 |
1325 #define MAYBE_BrowserCloseAfterDownload FAILS_BrowserCloseAfterDownload | 1325 IN_PROC_BROWSER_TEST_F(DownloadTest, FAILS_BrowserCloseAfterDownload) { |
1326 #else | |
1327 #define MAYBE_BrowserCloseAfterDownload BrowserCloseAfterDownload | |
1328 #endif | |
1329 IN_PROC_BROWSER_TEST_F(DownloadTest, MAYBE_BrowserCloseAfterDownload) { | |
1330 GURL downloads_url(chrome::kAboutFlagsURL); | 1326 GURL downloads_url(chrome::kAboutFlagsURL); |
1331 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 1327 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
1332 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file)); | 1328 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file)); |
1333 | 1329 |
1334 ui_test_utils::NavigateToURL(browser(), downloads_url); | 1330 ui_test_utils::NavigateToURL(browser(), downloads_url); |
1335 TabContents* contents = browser()->GetSelectedTabContents(); | 1331 TabContents* contents = browser()->GetSelectedTabContents(); |
1336 ASSERT_TRUE(contents); | 1332 ASSERT_TRUE(contents); |
1337 bool result = false; | 1333 bool result = false; |
1338 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 1334 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
1339 contents->render_view_host(), | 1335 contents->render_view_host(), |
1340 L"", | 1336 L"", |
1341 L"window.onunload = function() { var do_nothing = 0; }; " | 1337 L"window.onunload = function() { var do_nothing = 0; }; " |
1342 L"window.domAutomationController.send(true);", | 1338 L"window.domAutomationController.send(true);", |
1343 &result)); | 1339 &result)); |
1344 EXPECT_TRUE(result); | 1340 EXPECT_TRUE(result); |
1345 | 1341 |
1346 DownloadAndWait(browser(), download_url, EXPECT_NO_SELECT_DIALOG); | 1342 DownloadAndWait(browser(), download_url, EXPECT_NO_SELECT_DIALOG); |
1347 | 1343 |
1348 ui_test_utils::WindowedNotificationObserver signal( | 1344 ui_test_utils::WindowedNotificationObserver signal( |
1349 NotificationType::BROWSER_CLOSED, | 1345 NotificationType::BROWSER_CLOSED, |
1350 Source<Browser>(browser())); | 1346 Source<Browser>(browser())); |
1351 browser()->CloseWindow(); | 1347 browser()->CloseWindow(); |
1352 signal.Wait(); | 1348 signal.Wait(); |
1353 } | 1349 } |
1354 | 1350 |
1355 } // namespace | 1351 } // namespace |
OLD | NEW |