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

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

Issue 2810943003: chrome_download_manager_delegate_unittest.cc: Remove dead code. (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | no next file » | 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 using content::DownloadItem; 53 using content::DownloadItem;
54 using safe_browsing::DownloadFileType; 54 using safe_browsing::DownloadFileType;
55 55
56 namespace { 56 namespace {
57 57
58 class MockWebContentsDelegate : public content::WebContentsDelegate { 58 class MockWebContentsDelegate : public content::WebContentsDelegate {
59 public: 59 public:
60 ~MockWebContentsDelegate() override {} 60 ~MockWebContentsDelegate() override {}
61 }; 61 };
62 62
63 // Google Mock action that posts a task to the current message loop that invokes
64 // the first argument of the mocked method as a callback. Said argument must be
65 // a base::Callback<void(ParamType)>. |result| must be of |ParamType| and is
66 // bound as that parameter.
67 // Example:
68 // class FooClass {
69 // public:
70 // virtual void Foo(base::Callback<void(bool)> callback);
71 // };
72 // ...
73 // EXPECT_CALL(mock_fooclass_instance, Foo(callback))
74 // .WillOnce(ScheduleCallback(false));
75 ACTION_P(ScheduleCallback, result) {
76 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
77 base::Bind(arg0, result));
78 }
79
80 // Similar to ScheduleCallback, but binds 2 arguments.
81 ACTION_P2(ScheduleCallback2, result0, result1) {
82 base::ThreadTaskRunnerHandle::Get()->PostTask(
83 FROM_HERE, base::Bind(arg0, result0, result1));
84 }
85
86 // Subclass of the ChromeDownloadManagerDelegate that uses a mock 63 // Subclass of the ChromeDownloadManagerDelegate that uses a mock
87 // DownloadProtectionService. 64 // DownloadProtectionService.
88 class TestChromeDownloadManagerDelegate : public ChromeDownloadManagerDelegate { 65 class TestChromeDownloadManagerDelegate : public ChromeDownloadManagerDelegate {
89 public: 66 public:
90 explicit TestChromeDownloadManagerDelegate(Profile* profile) 67 explicit TestChromeDownloadManagerDelegate(Profile* profile)
91 : ChromeDownloadManagerDelegate(profile) { 68 : ChromeDownloadManagerDelegate(profile) {
92 ON_CALL(*this, MockCheckDownloadUrl(_, _)) 69 ON_CALL(*this, MockCheckDownloadUrl(_, _))
93 .WillByDefault(Return(content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS)); 70 .WillByDefault(Return(content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS));
94 ON_CALL(*this, GetDownloadProtectionService()) 71 ON_CALL(*this, GetDownloadProtectionService())
95 .WillByDefault(Return(nullptr)); 72 .WillByDefault(Return(nullptr));
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 EXPECT_CALL(*download_item, OnContentCheckCompleted(_)).Times(0); 657 EXPECT_CALL(*download_item, OnContentCheckCompleted(_)).Times(0);
681 } 658 }
682 659
683 base::RunLoop run_loop; 660 base::RunLoop run_loop;
684 ASSERT_FALSE(delegate()->ShouldCompleteDownload(download_item.get(), 661 ASSERT_FALSE(delegate()->ShouldCompleteDownload(download_item.get(),
685 run_loop.QuitClosure())); 662 run_loop.QuitClosure()));
686 run_loop.Run(); 663 run_loop.Run();
687 } 664 }
688 665
689 #endif // FULL_SAFE_BROWSING 666 #endif // FULL_SAFE_BROWSING
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698