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

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

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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 | Annotate | Revision Log
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 "base/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/files/scoped_temp_dir.h" 6 #include "base/files/scoped_temp_dir.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "chrome/browser/download/chrome_download_manager_delegate.h" 10 #include "chrome/browser/download/chrome_download_manager_delegate.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // bound as that parameter. 48 // bound as that parameter.
49 // Example: 49 // Example:
50 // class FooClass { 50 // class FooClass {
51 // public: 51 // public:
52 // virtual void Foo(base::Callback<void(bool)> callback); 52 // virtual void Foo(base::Callback<void(bool)> callback);
53 // }; 53 // };
54 // ... 54 // ...
55 // EXPECT_CALL(mock_fooclass_instance, Foo(callback)) 55 // EXPECT_CALL(mock_fooclass_instance, Foo(callback))
56 // .WillOnce(ScheduleCallback(false)); 56 // .WillOnce(ScheduleCallback(false));
57 ACTION_P(ScheduleCallback, result) { 57 ACTION_P(ScheduleCallback, result) {
58 MessageLoop::current()->PostTask(FROM_HERE, base::Bind(arg0, result)); 58 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(arg0, result));
59 } 59 }
60 60
61 // Similar to ScheduleCallback, but binds 2 arguments. 61 // Similar to ScheduleCallback, but binds 2 arguments.
62 ACTION_P2(ScheduleCallback2, result0, result1) { 62 ACTION_P2(ScheduleCallback2, result0, result1) {
63 MessageLoop::current()->PostTask( 63 base::MessageLoop::current()->PostTask(
64 FROM_HERE, base::Bind(arg0, result0, result1)); 64 FROM_HERE, base::Bind(arg0, result0, result1));
65 } 65 }
66 66
67 struct DownloadTarget { 67 struct DownloadTarget {
68 base::FilePath target_path; 68 base::FilePath target_path;
69 base::FilePath intermediate_path; 69 base::FilePath intermediate_path;
70 DownloadItem::TargetDisposition target_disposition; 70 DownloadItem::TargetDisposition target_disposition;
71 content::DownloadDangerType danger_type; 71 content::DownloadDangerType danger_type;
72 }; 72 };
73 73
(...skipping 20 matching lines...) Expand all
94 94
95 virtual void ReserveVirtualPath( 95 virtual void ReserveVirtualPath(
96 content::DownloadItem* download, 96 content::DownloadItem* download,
97 const base::FilePath& virtual_path, 97 const base::FilePath& virtual_path,
98 bool create_directory, 98 bool create_directory,
99 DownloadPathReservationTracker::FilenameConflictAction conflict_action, 99 DownloadPathReservationTracker::FilenameConflictAction conflict_action,
100 const DownloadPathReservationTracker::ReservedPathCallback& callback) 100 const DownloadPathReservationTracker::ReservedPathCallback& callback)
101 OVERRIDE { 101 OVERRIDE {
102 // Pretend the path reservation succeeded without any change to 102 // Pretend the path reservation succeeded without any change to
103 // |target_path|. 103 // |target_path|.
104 MessageLoop::current()->PostTask(FROM_HERE, 104 base::MessageLoop::current()->PostTask(
105 base::Bind(callback, virtual_path, true)); 105 FROM_HERE, base::Bind(callback, virtual_path, true));
106 } 106 }
107 107
108 virtual void PromptUserForDownloadPath( 108 virtual void PromptUserForDownloadPath(
109 DownloadItem* download, 109 DownloadItem* download,
110 const base::FilePath& suggested_path, 110 const base::FilePath& suggested_path,
111 const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback) 111 const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback)
112 OVERRIDE { 112 OVERRIDE {
113 base::FilePath return_path = MockPromptUserForDownloadPath(download, 113 base::FilePath return_path = MockPromptUserForDownloadPath(download,
114 suggested_path, 114 suggested_path,
115 callback); 115 callback);
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 DownloadTarget result; 364 DownloadTarget result;
365 base::FilePath expected_prompt_path(GetPathInDownloadDir("foo.txt")); 365 base::FilePath expected_prompt_path(GetPathInDownloadDir("foo.txt"));
366 EXPECT_CALL(*delegate(), 366 EXPECT_CALL(*delegate(),
367 MockPromptUserForDownloadPath(save_as_download.get(), 367 MockPromptUserForDownloadPath(save_as_download.get(),
368 expected_prompt_path, _)) 368 expected_prompt_path, _))
369 .WillOnce(Return(base::FilePath())); 369 .WillOnce(Return(base::FilePath()));
370 DetermineDownloadTarget(save_as_download.get(), &result); 370 DetermineDownloadTarget(save_as_download.get(), &result);
371 VerifyAndClearExpectations(); 371 VerifyAndClearExpectations();
372 } 372 }
373 } 373 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_sanity_browsertest.cc ('k') | chrome/browser/download/download_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698