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

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

Issue 14640020: [Resumption 9/11] Handle filename determination for resumed downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments 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"
11 #include "chrome/browser/download/download_prefs.h" 11 #include "chrome/browser/download/download_prefs.h"
12 #include "chrome/common/pref_names.h" 12 #include "chrome/common/pref_names.h"
13 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 13 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
14 #include "chrome/test/base/testing_pref_service_syncable.h" 14 #include "chrome/test/base/testing_pref_service_syncable.h"
15 #include "chrome/test/base/testing_profile.h" 15 #include "chrome/test/base/testing_profile.h"
16 #include "content/public/browser/download_interrupt_reasons.h"
16 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
17 #include "content/public/browser/web_contents_delegate.h" 18 #include "content/public/browser/web_contents_delegate.h"
18 #include "content/public/test/mock_download_item.h" 19 #include "content/public/test/mock_download_item.h"
19 #include "content/public/test/mock_download_manager.h" 20 #include "content/public/test/mock_download_manager.h"
20 #include "content/public/test/test_browser_thread.h" 21 #include "content/public/test/test_browser_thread.h"
21 #include "content/public/test/test_renderer_host.h" 22 #include "content/public/test/test_renderer_host.h"
22 #include "content/public/test/web_contents_tester.h" 23 #include "content/public/test/web_contents_tester.h"
23 #include "testing/gmock/include/gmock/gmock.h" 24 #include "testing/gmock/include/gmock/gmock.h"
24 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
25 26
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 ON_CALL(*item, GetDangerType()) 214 ON_CALL(*item, GetDangerType())
214 .WillByDefault(Return(content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS)); 215 .WillByDefault(Return(content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS));
215 ON_CALL(*item, GetForcedFilePath()) 216 ON_CALL(*item, GetForcedFilePath())
216 .WillByDefault(ReturnRefOfCopy(base::FilePath())); 217 .WillByDefault(ReturnRefOfCopy(base::FilePath()));
217 ON_CALL(*item, GetFullPath()) 218 ON_CALL(*item, GetFullPath())
218 .WillByDefault(ReturnRefOfCopy(base::FilePath())); 219 .WillByDefault(ReturnRefOfCopy(base::FilePath()));
219 ON_CALL(*item, GetHash()) 220 ON_CALL(*item, GetHash())
220 .WillByDefault(ReturnRefOfCopy(std::string())); 221 .WillByDefault(ReturnRefOfCopy(std::string()));
221 ON_CALL(*item, GetId()) 222 ON_CALL(*item, GetId())
222 .WillByDefault(Return(id)); 223 .WillByDefault(Return(id));
224 ON_CALL(*item, GetLastReason())
225 .WillByDefault(Return(content::DOWNLOAD_INTERRUPT_REASON_NONE));
223 ON_CALL(*item, GetReferrerUrl()) 226 ON_CALL(*item, GetReferrerUrl())
224 .WillByDefault(ReturnRefOfCopy(GURL())); 227 .WillByDefault(ReturnRefOfCopy(GURL()));
225 ON_CALL(*item, GetState()) 228 ON_CALL(*item, GetState())
226 .WillByDefault(Return(DownloadItem::IN_PROGRESS)); 229 .WillByDefault(Return(DownloadItem::IN_PROGRESS));
230 ON_CALL(*item, GetTargetFilePath())
231 .WillByDefault(ReturnRefOfCopy(base::FilePath()));
227 ON_CALL(*item, GetTransitionType()) 232 ON_CALL(*item, GetTransitionType())
228 .WillByDefault(Return(content::PAGE_TRANSITION_LINK)); 233 .WillByDefault(Return(content::PAGE_TRANSITION_LINK));
229 ON_CALL(*item, GetWebContents()) 234 ON_CALL(*item, GetWebContents())
230 .WillByDefault(Return(web_contents())); 235 .WillByDefault(Return(web_contents()));
231 ON_CALL(*item, HasUserGesture()) 236 ON_CALL(*item, HasUserGesture())
232 .WillByDefault(Return(false)); 237 .WillByDefault(Return(false));
233 ON_CALL(*item, IsDangerous()) 238 ON_CALL(*item, IsDangerous())
234 .WillByDefault(Return(false)); 239 .WillByDefault(Return(false));
235 ON_CALL(*item, IsTemporary()) 240 ON_CALL(*item, IsTemporary())
236 .WillByDefault(Return(false)); 241 .WillByDefault(Return(false));
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 DownloadTarget result; 367 DownloadTarget result;
363 base::FilePath expected_prompt_path(GetPathInDownloadDir("foo.txt")); 368 base::FilePath expected_prompt_path(GetPathInDownloadDir("foo.txt"));
364 EXPECT_CALL(*delegate(), 369 EXPECT_CALL(*delegate(),
365 MockPromptUserForDownloadPath(save_as_download.get(), 370 MockPromptUserForDownloadPath(save_as_download.get(),
366 expected_prompt_path, _)) 371 expected_prompt_path, _))
367 .WillOnce(Return(base::FilePath())); 372 .WillOnce(Return(base::FilePath()));
368 DetermineDownloadTarget(save_as_download.get(), &result); 373 DetermineDownloadTarget(save_as_download.get(), &result);
369 VerifyAndClearExpectations(); 374 VerifyAndClearExpectations();
370 } 375 }
371 } 376 }
OLDNEW
« no previous file with comments | « chrome/browser/download/chrome_download_manager_delegate.cc ('k') | chrome/browser/download/download_target_determiner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698