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/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
10 #include "base/test/test_file_util.h" | 10 #include "base/test/test_file_util.h" |
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1324 EXPECT_EQ(origin_size, info.total_bytes); | 1324 EXPECT_EQ(origin_size, info.total_bytes); |
1325 EXPECT_EQ(DownloadItem::COMPLETE, info.state); | 1325 EXPECT_EQ(DownloadItem::COMPLETE, info.state); |
1326 } | 1326 } |
1327 | 1327 |
1328 // Test for crbug.com/14505. This tests that chrome:// urls are still functional | 1328 // Test for crbug.com/14505. This tests that chrome:// urls are still functional |
1329 // after download of a file while viewing another chrome://. | 1329 // after download of a file while viewing another chrome://. |
1330 IN_PROC_BROWSER_TEST_F(DownloadTest, ChromeURLAfterDownload) { | 1330 IN_PROC_BROWSER_TEST_F(DownloadTest, ChromeURLAfterDownload) { |
1331 ASSERT_TRUE(InitialSetup(false)); | 1331 ASSERT_TRUE(InitialSetup(false)); |
1332 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 1332 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
1333 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file)); | 1333 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file)); |
1334 GURL flags_url(chrome::kAboutFlagsURL); | 1334 GURL flags_url(chrome::kChromeUIFlagsURL); |
1335 GURL extensions_url(chrome::kChromeUIExtensionsURL); | 1335 GURL extensions_url(chrome::kChromeUIExtensionsURL); |
1336 | 1336 |
1337 ui_test_utils::NavigateToURL(browser(), flags_url); | 1337 ui_test_utils::NavigateToURL(browser(), flags_url); |
1338 DownloadAndWait(browser(), download_url, EXPECT_NO_SELECT_DIALOG); | 1338 DownloadAndWait(browser(), download_url, EXPECT_NO_SELECT_DIALOG); |
1339 ui_test_utils::NavigateToURL(browser(), extensions_url); | 1339 ui_test_utils::NavigateToURL(browser(), extensions_url); |
1340 TabContents* contents = browser()->GetSelectedTabContents(); | 1340 TabContents* contents = browser()->GetSelectedTabContents(); |
1341 ASSERT_TRUE(contents); | 1341 ASSERT_TRUE(contents); |
1342 bool webui_responded = false; | 1342 bool webui_responded = false; |
1343 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 1343 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
1344 contents->render_view_host(), | 1344 contents->render_view_host(), |
1345 L"", | 1345 L"", |
1346 L"window.domAutomationController.send(window.webui_responded_);", | 1346 L"window.domAutomationController.send(window.webui_responded_);", |
1347 &webui_responded)); | 1347 &webui_responded)); |
1348 EXPECT_TRUE(webui_responded); | 1348 EXPECT_TRUE(webui_responded); |
1349 } | 1349 } |
1350 | 1350 |
1351 // Test for crbug.com/12745. This tests that if a download is initiated from | 1351 // Test for crbug.com/12745. This tests that if a download is initiated from |
1352 // a chrome:// page that has registered and onunload handler, the browser | 1352 // a chrome:// page that has registered and onunload handler, the browser |
1353 // will be able to close. | 1353 // will be able to close. |
1354 // After several correct executions, this test starts failing on the build | 1354 // After several correct executions, this test starts failing on the build |
1355 // bots and then continues to fail consistently. | 1355 // bots and then continues to fail consistently. |
1356 // As of 2011/05/22, it's crashing, so it is getting disabled. | 1356 // As of 2011/05/22, it's crashing, so it is getting disabled. |
1357 // http://crbug.com/82278 | 1357 // http://crbug.com/82278 |
1358 IN_PROC_BROWSER_TEST_F(DownloadTest, DISABLED_BrowserCloseAfterDownload) { | 1358 IN_PROC_BROWSER_TEST_F(DownloadTest, DISABLED_BrowserCloseAfterDownload) { |
1359 GURL downloads_url(chrome::kAboutFlagsURL); | 1359 GURL downloads_url(chrome::kChromeUIFlagsURL); |
1360 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 1360 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
1361 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file)); | 1361 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file)); |
1362 | 1362 |
1363 ui_test_utils::NavigateToURL(browser(), downloads_url); | 1363 ui_test_utils::NavigateToURL(browser(), downloads_url); |
1364 TabContents* contents = browser()->GetSelectedTabContents(); | 1364 TabContents* contents = browser()->GetSelectedTabContents(); |
1365 ASSERT_TRUE(contents); | 1365 ASSERT_TRUE(contents); |
1366 bool result = false; | 1366 bool result = false; |
1367 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 1367 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
1368 contents->render_view_host(), | 1368 contents->render_view_host(), |
1369 L"", | 1369 L"", |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 EXPECT_EQ(DownloadItem::COMPLETE, downloads[0]->state()); | 1404 EXPECT_EQ(DownloadItem::COMPLETE, downloads[0]->state()); |
1405 EXPECT_TRUE(downloads[0]->opened()); | 1405 EXPECT_TRUE(downloads[0]->opened()); |
1406 | 1406 |
1407 // As long as we're here, confirmed everything else is good. | 1407 // As long as we're here, confirmed everything else is good. |
1408 EXPECT_EQ(1, browser()->tab_count()); | 1408 EXPECT_EQ(1, browser()->tab_count()); |
1409 CheckDownload(browser(), file, file); | 1409 CheckDownload(browser(), file, file); |
1410 // Dissapears on most UIs, but the download panel sticks around for | 1410 // Dissapears on most UIs, but the download panel sticks around for |
1411 // chrome os. | 1411 // chrome os. |
1412 CheckDownloadUIVisible(browser(), false, true); | 1412 CheckDownloadUIVisible(browser(), false, true); |
1413 } | 1413 } |
OLD | NEW |