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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 #include "content/public/browser/download_manager.h" | 71 #include "content/public/browser/download_manager.h" |
72 #include "content/public/browser/download_save_info.h" | 72 #include "content/public/browser/download_save_info.h" |
73 #include "content/public/browser/download_url_parameters.h" | 73 #include "content/public/browser/download_url_parameters.h" |
74 #include "content/public/browser/notification_source.h" | 74 #include "content/public/browser/notification_source.h" |
75 #include "content/public/browser/render_frame_host.h" | 75 #include "content/public/browser/render_frame_host.h" |
76 #include "content/public/browser/render_view_host.h" | 76 #include "content/public/browser/render_view_host.h" |
77 #include "content/public/browser/resource_context.h" | 77 #include "content/public/browser/resource_context.h" |
78 #include "content/public/browser/web_contents.h" | 78 #include "content/public/browser/web_contents.h" |
79 #include "content/public/common/content_switches.h" | 79 #include "content/public/common/content_switches.h" |
80 #include "content/public/common/context_menu_params.h" | 80 #include "content/public/common/context_menu_params.h" |
81 #include "content/public/common/page_transition_types.h" | |
82 #include "content/public/test/browser_test_utils.h" | 81 #include "content/public/test/browser_test_utils.h" |
83 #include "content/public/test/download_test_observer.h" | 82 #include "content/public/test/download_test_observer.h" |
84 #include "content/public/test/test_file_error_injector.h" | 83 #include "content/public/test/test_file_error_injector.h" |
85 #include "content/public/test/test_navigation_observer.h" | 84 #include "content/public/test/test_navigation_observer.h" |
86 #include "content/test/net/url_request_slow_download_job.h" | 85 #include "content/test/net/url_request_slow_download_job.h" |
87 #include "extensions/browser/extension_system.h" | 86 #include "extensions/browser/extension_system.h" |
88 #include "extensions/common/feature_switch.h" | 87 #include "extensions/common/feature_switch.h" |
89 #include "net/base/filename_util.h" | 88 #include "net/base/filename_util.h" |
90 #include "net/test/spawned_test_server/spawned_test_server.h" | 89 #include "net/test/spawned_test_server/spawned_test_server.h" |
91 #include "net/test/url_request/url_request_mock_http_job.h" | 90 #include "net/test/url_request/url_request_mock_http_job.h" |
92 #include "testing/gtest/include/gtest/gtest.h" | 91 #include "testing/gtest/include/gtest/gtest.h" |
93 #include "ui/base/l10n/l10n_util.h" | 92 #include "ui/base/l10n/l10n_util.h" |
| 93 #include "ui/base/page_transition_types.h" |
94 | 94 |
95 #if defined(FULL_SAFE_BROWSING) | 95 #if defined(FULL_SAFE_BROWSING) |
96 #include "chrome/browser/safe_browsing/download_feedback_service.h" | 96 #include "chrome/browser/safe_browsing/download_feedback_service.h" |
97 #include "chrome/browser/safe_browsing/download_protection_service.h" | 97 #include "chrome/browser/safe_browsing/download_protection_service.h" |
98 #include "chrome/browser/safe_browsing/safe_browsing_database.h" | 98 #include "chrome/browser/safe_browsing/safe_browsing_database.h" |
99 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 99 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
100 #endif | 100 #endif |
101 | 101 |
102 using content::BrowserContext; | 102 using content::BrowserContext; |
103 using content::BrowserThread; | 103 using content::BrowserThread; |
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1335 CheckDownload(browser(), download_file, file); | 1335 CheckDownload(browser(), download_file, file); |
1336 | 1336 |
1337 // Check state. | 1337 // Check state. |
1338 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 1338 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
1339 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); | 1339 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); |
1340 | 1340 |
1341 // Open a second tab and wait. | 1341 // Open a second tab and wait. |
1342 EXPECT_NE(static_cast<WebContents*>(NULL), | 1342 EXPECT_NE(static_cast<WebContents*>(NULL), |
1343 chrome::AddSelectedTabWithURL(browser(), | 1343 chrome::AddSelectedTabWithURL(browser(), |
1344 GURL(url::kAboutBlankURL), | 1344 GURL(url::kAboutBlankURL), |
1345 content::PAGE_TRANSITION_TYPED)); | 1345 ui::PAGE_TRANSITION_TYPED)); |
1346 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 1346 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
1347 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); | 1347 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); |
1348 | 1348 |
1349 // Hide the download shelf. | 1349 // Hide the download shelf. |
1350 browser()->window()->GetDownloadShelf()->Close(DownloadShelf::AUTOMATIC); | 1350 browser()->window()->GetDownloadShelf()->Close(DownloadShelf::AUTOMATIC); |
1351 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | 1351 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); |
1352 | 1352 |
1353 // Go to the first tab. | 1353 // Go to the first tab. |
1354 browser()->tab_strip_model()->ActivateTabAt(0, true); | 1354 browser()->tab_strip_model()->ActivateTabAt(0, true); |
1355 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 1355 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
(...skipping 2172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3528 *(downloads[0]))); | 3528 *(downloads[0]))); |
3529 | 3529 |
3530 // Begin feedback and check that the file is "stolen". | 3530 // Begin feedback and check that the file is "stolen". |
3531 download_protection_service->feedback_service()->BeginFeedbackForDownload( | 3531 download_protection_service->feedback_service()->BeginFeedbackForDownload( |
3532 downloads[0]); | 3532 downloads[0]); |
3533 std::vector<DownloadItem*> updated_downloads; | 3533 std::vector<DownloadItem*> updated_downloads; |
3534 GetDownloads(browser(), &updated_downloads); | 3534 GetDownloads(browser(), &updated_downloads); |
3535 ASSERT_TRUE(updated_downloads.empty()); | 3535 ASSERT_TRUE(updated_downloads.empty()); |
3536 } | 3536 } |
3537 #endif | 3537 #endif |
OLD | NEW |