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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 web_contents, web_contents, true); | 1170 web_contents, web_contents, true); |
1171 ASSERT_TRUE(tab_download_state); | 1171 ASSERT_TRUE(tab_download_state); |
1172 tab_download_state->set_download_status( | 1172 tab_download_state->set_download_status( |
1173 DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED); | 1173 DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED); |
1174 | 1174 |
1175 // Try to start the download via Javascript and wait for the corresponding | 1175 // Try to start the download via Javascript and wait for the corresponding |
1176 // load stop event. | 1176 // load stop event. |
1177 content::TestNavigationObserver observer( | 1177 content::TestNavigationObserver observer( |
1178 content::Source<content::NavigationController>( | 1178 content::Source<content::NavigationController>( |
1179 &web_contents->GetController()), | 1179 &web_contents->GetController()), |
1180 NULL, | |
1181 1); | 1180 1); |
1182 bool download_assempted; | 1181 bool download_assempted; |
1183 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 1182 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
1184 browser()->tab_strip_model()->GetActiveWebContents(), | 1183 browser()->tab_strip_model()->GetActiveWebContents(), |
1185 "window.domAutomationController.send(startDownload());", | 1184 "window.domAutomationController.send(startDownload());", |
1186 &download_assempted)); | 1185 &download_assempted)); |
1187 ASSERT_TRUE(download_assempted); | 1186 ASSERT_TRUE(download_assempted); |
1188 observer.WaitForObservation( | 1187 observer.WaitForObservation( |
1189 base::Bind(&content::RunMessageLoop), | 1188 base::Bind(&content::RunMessageLoop), |
1190 base::Bind(&MessageLoop::Quit, | 1189 base::Bind(&MessageLoop::Quit, |
(...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2922 scoped_ptr<content::DownloadTestObserver> observer( | 2921 scoped_ptr<content::DownloadTestObserver> observer( |
2923 DangerousDownloadWaiter( | 2922 DangerousDownloadWaiter( |
2924 browser(), 1, | 2923 browser(), 1, |
2925 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); | 2924 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); |
2926 ui_test_utils::NavigateToURL(browser(), url); | 2925 ui_test_utils::NavigateToURL(browser(), url); |
2927 observer->WaitForFinished(); | 2926 observer->WaitForFinished(); |
2928 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::CANCELLED)); | 2927 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::CANCELLED)); |
2929 EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen()); | 2928 EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen()); |
2930 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | 2929 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); |
2931 } | 2930 } |
OLD | NEW |