OLD | NEW |
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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 SetDefaultDownloadPath(test_download_dir_.path()); | 194 SetDefaultDownloadPath(test_download_dir_.path()); |
195 } | 195 } |
196 | 196 |
197 void ChromeDownloadManagerDelegateTest::TearDown() { | 197 void ChromeDownloadManagerDelegateTest::TearDown() { |
198 message_loop_.RunUntilIdle(); | 198 message_loop_.RunUntilIdle(); |
199 delegate_->Shutdown(); | 199 delegate_->Shutdown(); |
200 ChromeRenderViewHostTestHarness::TearDown(); | 200 ChromeRenderViewHostTestHarness::TearDown(); |
201 } | 201 } |
202 | 202 |
203 void ChromeDownloadManagerDelegateTest::VerifyAndClearExpectations() { | 203 void ChromeDownloadManagerDelegateTest::VerifyAndClearExpectations() { |
204 ::testing::Mock::VerifyAndClearExpectations(delegate_); | 204 ::testing::Mock::VerifyAndClearExpectations(delegate_.get()); |
205 } | 205 } |
206 | 206 |
207 content::MockDownloadItem* | 207 content::MockDownloadItem* |
208 ChromeDownloadManagerDelegateTest::CreateActiveDownloadItem(int32 id) { | 208 ChromeDownloadManagerDelegateTest::CreateActiveDownloadItem(int32 id) { |
209 content::MockDownloadItem* item = | 209 content::MockDownloadItem* item = |
210 new ::testing::NiceMock<content::MockDownloadItem>(); | 210 new ::testing::NiceMock<content::MockDownloadItem>(); |
211 ON_CALL(*item, GetBrowserContext()) | 211 ON_CALL(*item, GetBrowserContext()) |
212 .WillByDefault(Return(profile())); | 212 .WillByDefault(Return(profile())); |
213 ON_CALL(*item, GetDangerType()) | 213 ON_CALL(*item, GetDangerType()) |
214 .WillByDefault(Return(content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS)); | 214 .WillByDefault(Return(content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS)); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 DownloadTarget result; | 362 DownloadTarget result; |
363 base::FilePath expected_prompt_path(GetPathInDownloadDir("foo.txt")); | 363 base::FilePath expected_prompt_path(GetPathInDownloadDir("foo.txt")); |
364 EXPECT_CALL(*delegate(), | 364 EXPECT_CALL(*delegate(), |
365 MockPromptUserForDownloadPath(save_as_download.get(), | 365 MockPromptUserForDownloadPath(save_as_download.get(), |
366 expected_prompt_path, _)) | 366 expected_prompt_path, _)) |
367 .WillOnce(Return(base::FilePath())); | 367 .WillOnce(Return(base::FilePath())); |
368 DetermineDownloadTarget(save_as_download.get(), &result); | 368 DetermineDownloadTarget(save_as_download.get(), &result); |
369 VerifyAndClearExpectations(); | 369 VerifyAndClearExpectations(); |
370 } | 370 } |
371 } | 371 } |
OLD | NEW |