Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Side by Side Diff: chrome/browser/download/download_browsertest.cc

Issue 1704793002: Remove kDisableDownloadNotification and stop compiling shelf code on (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/download/download_ui_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 }; 293 };
294 294
295 static DownloadManager* DownloadManagerForBrowser(Browser* browser) { 295 static DownloadManager* DownloadManagerForBrowser(Browser* browser) {
296 return BrowserContext::GetDownloadManager(browser->profile()); 296 return BrowserContext::GetDownloadManager(browser->profile());
297 } 297 }
298 298
299 bool WasAutoOpened(DownloadItem* item) { 299 bool WasAutoOpened(DownloadItem* item) {
300 return item->GetAutoOpened(); 300 return item->GetAutoOpened();
301 } 301 }
302 302
303 #if !defined(OS_CHROMEOS)
303 // Called when a download starts. Marks the download as hidden. 304 // Called when a download starts. Marks the download as hidden.
304 void SetHiddenDownloadCallback(DownloadItem* item, 305 void SetHiddenDownloadCallback(DownloadItem* item,
305 content::DownloadInterruptReason reason) { 306 content::DownloadInterruptReason reason) {
306 DownloadItemModel(item).SetShouldShowInShelf(false); 307 DownloadItemModel(item).SetShouldShowInShelf(false);
307 } 308 }
309 #endif
308 310
309 // Callback for HistoryObserver; used in DownloadHistoryCheck 311 // Callback for HistoryObserver; used in DownloadHistoryCheck
310 bool HasDataAndName(const history::DownloadRow& row) { 312 bool HasDataAndName(const history::DownloadRow& row) {
311 return row.received_bytes > 0 && !row.target_path.empty(); 313 return row.received_bytes > 0 && !row.target_path.empty();
312 } 314 }
313 315
314 } // namespace 316 } // namespace
315 317
316 DownloadTestObserverNotInProgress::DownloadTestObserverNotInProgress( 318 DownloadTestObserverNotInProgress::DownloadTestObserverNotInProgress(
317 DownloadManager* download_manager, 319 DownloadManager* download_manager,
(...skipping 3058 matching lines...) Expand 10 before | Expand all | Expand 10 after
3376 3378
3377 // Begin feedback and check that the file is "stolen". 3379 // Begin feedback and check that the file is "stolen".
3378 download_protection_service->feedback_service()->BeginFeedbackForDownload( 3380 download_protection_service->feedback_service()->BeginFeedbackForDownload(
3379 downloads[0]); 3381 downloads[0]);
3380 std::vector<DownloadItem*> updated_downloads; 3382 std::vector<DownloadItem*> updated_downloads;
3381 GetDownloads(browser(), &updated_downloads); 3383 GetDownloads(browser(), &updated_downloads);
3382 ASSERT_TRUE(updated_downloads.empty()); 3384 ASSERT_TRUE(updated_downloads.empty());
3383 } 3385 }
3384 #endif // FULL_SAFE_BROWSING 3386 #endif // FULL_SAFE_BROWSING
3385 3387
3388 #if !defined(OS_CHROMEOS)
3386 class DownloadTestWithShelf : public DownloadTest { 3389 class DownloadTestWithShelf : public DownloadTest {
3387 void SetUpCommandLine(base::CommandLine* command_line) override { 3390 void SetUpCommandLine(base::CommandLine* command_line) override {
3388 #if defined(OS_CHROMEOS)
3389 command_line->AppendSwitch(switches::kDisableDownloadNotification);
3390 #endif
3391 DownloadTest::SetUpCommandLine(command_line); 3391 DownloadTest::SetUpCommandLine(command_line);
3392 } 3392 }
3393 }; 3393 };
3394 3394
3395 // Test that the download shelf is shown by starting a download. 3395 // Test that the download shelf is shown by starting a download.
3396 IN_PROC_BROWSER_TEST_F(DownloadTestWithShelf, DownloadAndWait) { 3396 IN_PROC_BROWSER_TEST_F(DownloadTestWithShelf, DownloadAndWait) {
3397 GURL url = net::URLRequestMockHTTPJob::GetMockUrl("downloads/a_zip_file.zip"); 3397 GURL url = net::URLRequestMockHTTPJob::GetMockUrl("downloads/a_zip_file.zip");
3398 DownloadAndWait(browser(), url); 3398 DownloadAndWait(browser(), url);
3399 3399
3400 // The download shelf should be visible. 3400 // The download shelf should be visible.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
3545 DownloadAndWait(browser(), download_url); 3545 DownloadAndWait(browser(), download_url);
3546 observer.WaitForStored(); 3546 observer.WaitForStored();
3547 HistoryServiceFactory::GetForProfile(browser()->profile(), 3547 HistoryServiceFactory::GetForProfile(browser()->profile(),
3548 ServiceAccessType::IMPLICIT_ACCESS) 3548 ServiceAccessType::IMPLICIT_ACCESS)
3549 ->FlushForTest(base::Bind( 3549 ->FlushForTest(base::Bind(
3550 &base::MessageLoop::QuitWhenIdle, 3550 &base::MessageLoop::QuitWhenIdle,
3551 base::Unretained(base::MessageLoop::current()->current()))); 3551 base::Unretained(base::MessageLoop::current()->current())));
3552 content::RunMessageLoop(); 3552 content::RunMessageLoop();
3553 } 3553 }
3554 3554
3555 #if defined(OS_CHROMEOS) 3555 IN_PROC_BROWSER_TEST_F(DownloadTestWithShelf, DownloadTest_History) {
3556 // Times out on ChromeOS: http://crbug.com/217810
3557 #define MAYBE_DownloadTest_History DISABLED_DownloadTest_History
3558 #else
3559 #define MAYBE_DownloadTest_History DownloadTest_History
3560 #endif
3561 IN_PROC_BROWSER_TEST_F(DownloadTestWithShelf, MAYBE_DownloadTest_History) {
3562 // This starts up right after PRE_DownloadTest_History and shares the same 3556 // This starts up right after PRE_DownloadTest_History and shares the same
3563 // profile directory. 3557 // profile directory.
3564 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(kDownloadTest1Path)); 3558 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(kDownloadTest1Path));
3565 std::vector<DownloadItem*> downloads; 3559 std::vector<DownloadItem*> downloads;
3566 content::DownloadManager* manager = DownloadManagerForBrowser(browser()); 3560 content::DownloadManager* manager = DownloadManagerForBrowser(browser());
3567 3561
3568 // Wait for the history to be loaded with a single DownloadItem. Check that 3562 // Wait for the history to be loaded with a single DownloadItem. Check that
3569 // it's the file that was downloaded in PRE_DownloadTest_History. 3563 // it's the file that was downloaded in PRE_DownloadTest_History.
3570 base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); 3564 base::FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
3571 CreatedObserver created_observer(manager); 3565 CreatedObserver created_observer(manager);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
3636 3630
3637 scoped_ptr<content::DownloadTestObserver> observer(DangerousDownloadWaiter( 3631 scoped_ptr<content::DownloadTestObserver> observer(DangerousDownloadWaiter(
3638 browser(), 1, content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); 3632 browser(), 1, content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY));
3639 ui_test_utils::NavigateToURL(browser(), extension_url); 3633 ui_test_utils::NavigateToURL(browser(), extension_url);
3640 3634
3641 observer->WaitForFinished(); 3635 observer->WaitForFinished();
3642 3636
3643 // Download shelf should close. 3637 // Download shelf should close.
3644 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 3638 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
3645 } 3639 }
3640 #endif
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/download/download_ui_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698