| 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 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 // Make sure the initial navigation didn't trigger a download. | 1349 // Make sure the initial navigation didn't trigger a download. |
| 1350 EXPECT_TRUE(VerifyNoDownloads()); | 1350 EXPECT_TRUE(VerifyNoDownloads()); |
| 1351 | 1351 |
| 1352 // Disable downloads for the tab. | 1352 // Disable downloads for the tab. |
| 1353 WebContents* web_contents = | 1353 WebContents* web_contents = |
| 1354 browser()->tab_strip_model()->GetActiveWebContents(); | 1354 browser()->tab_strip_model()->GetActiveWebContents(); |
| 1355 DownloadRequestLimiter::TabDownloadState* tab_download_state = | 1355 DownloadRequestLimiter::TabDownloadState* tab_download_state = |
| 1356 g_browser_process->download_request_limiter()->GetDownloadState( | 1356 g_browser_process->download_request_limiter()->GetDownloadState( |
| 1357 web_contents, web_contents, true); | 1357 web_contents, web_contents, true); |
| 1358 ASSERT_TRUE(tab_download_state); | 1358 ASSERT_TRUE(tab_download_state); |
| 1359 tab_download_state->set_download_status( | 1359 tab_download_state->SetDownloadStatusAndNotify( |
| 1360 DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED); | 1360 DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED); |
| 1361 | 1361 |
| 1362 // Try to start the download via Javascript and wait for the corresponding | 1362 // Try to start the download via Javascript and wait for the corresponding |
| 1363 // load stop event. | 1363 // load stop event. |
| 1364 content::TestNavigationObserver observer(web_contents); | 1364 content::TestNavigationObserver observer(web_contents); |
| 1365 bool download_attempted; | 1365 bool download_attempted; |
| 1366 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 1366 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| 1367 browser()->tab_strip_model()->GetActiveWebContents(), | 1367 browser()->tab_strip_model()->GetActiveWebContents(), |
| 1368 "window.domAutomationController.send(startDownload());", | 1368 "window.domAutomationController.send(startDownload());", |
| 1369 &download_attempted)); | 1369 &download_attempted)); |
| (...skipping 2367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3737 browser(), 1, | 3737 browser(), 1, |
| 3738 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); | 3738 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); |
| 3739 ui_test_utils::NavigateToURL(browser(), extension_url); | 3739 ui_test_utils::NavigateToURL(browser(), extension_url); |
| 3740 | 3740 |
| 3741 observer->WaitForFinished(); | 3741 observer->WaitForFinished(); |
| 3742 | 3742 |
| 3743 // Download shelf should close. | 3743 // Download shelf should close. |
| 3744 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | 3744 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); |
| 3745 } | 3745 } |
| 3746 #endif // defined(OS_CHROMEOS) | 3746 #endif // defined(OS_CHROMEOS) |
| OLD | NEW |