OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/download/download_browsertest.h" | 5 #include "chrome/browser/download/download_browsertest.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <sstream> | 8 #include <sstream> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1350 // Make sure the initial navigation didn't trigger a download. | 1350 // Make sure the initial navigation didn't trigger a download. |
1351 EXPECT_TRUE(VerifyNoDownloads()); | 1351 EXPECT_TRUE(VerifyNoDownloads()); |
1352 | 1352 |
1353 // Disable downloads for the tab. | 1353 // Disable downloads for the tab. |
1354 WebContents* web_contents = | 1354 WebContents* web_contents = |
1355 browser()->tab_strip_model()->GetActiveWebContents(); | 1355 browser()->tab_strip_model()->GetActiveWebContents(); |
1356 DownloadRequestLimiter::TabDownloadState* tab_download_state = | 1356 DownloadRequestLimiter::TabDownloadState* tab_download_state = |
1357 g_browser_process->download_request_limiter()->GetDownloadState( | 1357 g_browser_process->download_request_limiter()->GetDownloadState( |
1358 web_contents, web_contents, true); | 1358 web_contents, web_contents, true); |
1359 ASSERT_TRUE(tab_download_state); | 1359 ASSERT_TRUE(tab_download_state); |
1360 tab_download_state->set_download_status( | 1360 tab_download_state->SetDownloadStatusAndNotify( |
1361 DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED); | 1361 DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED); |
1362 | 1362 |
1363 // Try to start the download via Javascript and wait for the corresponding | 1363 // Try to start the download via Javascript and wait for the corresponding |
1364 // load stop event. | 1364 // load stop event. |
1365 content::TestNavigationObserver observer(web_contents); | 1365 content::TestNavigationObserver observer(web_contents); |
1366 bool download_attempted; | 1366 bool download_attempted; |
1367 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 1367 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
1368 browser()->tab_strip_model()->GetActiveWebContents(), | 1368 browser()->tab_strip_model()->GetActiveWebContents(), |
1369 "window.domAutomationController.send(startDownload());", | 1369 "window.domAutomationController.send(startDownload());", |
1370 &download_attempted)); | 1370 &download_attempted)); |
(...skipping 2427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3798 browser(), 1, | 3798 browser(), 1, |
3799 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); | 3799 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); |
3800 ui_test_utils::NavigateToURL(browser(), extension_url); | 3800 ui_test_utils::NavigateToURL(browser(), extension_url); |
3801 | 3801 |
3802 observer->WaitForFinished(); | 3802 observer->WaitForFinished(); |
3803 | 3803 |
3804 // Download shelf should close. | 3804 // Download shelf should close. |
3805 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | 3805 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); |
3806 } | 3806 } |
3807 #endif // defined(OS_CHROMEOS) | 3807 #endif // defined(OS_CHROMEOS) |
OLD | NEW |