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

Side by Side Diff: content/browser/download/download_item_impl_unittest.cc

Issue 10689093: Move Rename functionality from DownloadFileManager to DownloadFileImple. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Upload fater merging past revert to figure out if I still have a patch. Created 8 years, 5 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/message_loop.h" 5 #include "base/message_loop.h"
6 #include "base/stl_util.h" 6 #include "base/stl_util.h"
7 #include "base/threading/thread.h" 7 #include "base/threading/thread.h"
8 #include "content/browser/download/byte_stream.h" 8 #include "content/browser/download/byte_stream.h"
9 #include "content/browser/download/download_create_info.h" 9 #include "content/browser/download/download_create_info.h"
10 #include "content/browser/download/download_file_manager.h" 10 #include "content/browser/download/download_file_manager.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 ~MockDownloadFileManager() {} 94 ~MockDownloadFileManager() {}
95 }; 95 };
96 96
97 // Schedules a task to invoke the RenameCompletionCallback with |new_path| on 97 // Schedules a task to invoke the RenameCompletionCallback with |new_path| on
98 // the UI thread. Should only be used as the action for 98 // the UI thread. Should only be used as the action for
99 // MockDownloadFileManager::Rename*DownloadFile as follows: 99 // MockDownloadFileManager::Rename*DownloadFile as follows:
100 // EXPECT_CALL(mock_download_file_manager, 100 // EXPECT_CALL(mock_download_file_manager,
101 // RenameDownloadFile(_,_,_,_)) 101 // RenameDownloadFile(_,_,_,_))
102 // .WillOnce(ScheduleRenameCallback(new_path)); 102 // .WillOnce(ScheduleRenameCallback(new_path));
103 ACTION_P(ScheduleRenameCallback, new_path) { 103 ACTION_P(ScheduleRenameCallback, new_path) {
104 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 104 BrowserThread::PostTask(
105 base::Bind(arg3, new_path)); 105 BrowserThread::UI, FROM_HERE,
106 base::Bind(arg3, content::DOWNLOAD_INTERRUPT_REASON_NONE, new_path));
106 } 107 }
107 108
108 // Similarly for scheduling a completion callback. 109 // Similarly for scheduling a completion callback.
109 ACTION(ScheduleCompleteCallback) { 110 ACTION(ScheduleCompleteCallback) {
110 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(arg1)); 111 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(arg1));
111 } 112 }
112 113
113 MockDownloadFileManager::MockDownloadFileManager() 114 MockDownloadFileManager::MockDownloadFileManager()
114 : DownloadFileManager(new MockDownloadFileFactory) { 115 : DownloadFileManager(new MockDownloadFileFactory) {
115 } 116 }
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 DownloadItem* item = CreateDownloadItem(DownloadItem::IN_PROGRESS); 577 DownloadItem* item = CreateDownloadItem(DownloadItem::IN_PROGRESS);
577 578
578 EXPECT_FALSE(item->GetFileExternallyRemoved()); 579 EXPECT_FALSE(item->GetFileExternallyRemoved());
579 item->OnDownloadedFileRemoved(); 580 item->OnDownloadedFileRemoved();
580 EXPECT_TRUE(item->GetFileExternallyRemoved()); 581 EXPECT_TRUE(item->GetFileExternallyRemoved());
581 } 582 }
582 583
583 TEST(MockDownloadItem, Compiles) { 584 TEST(MockDownloadItem, Compiles) {
584 MockDownloadItem mock_item; 585 MockDownloadItem mock_item;
585 } 586 }
OLDNEW
« no previous file with comments | « content/browser/download/download_item_impl.cc ('k') | content/browser/download/download_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698