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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 content::MockDownloadItem* item) { | 393 content::MockDownloadItem* item) { |
394 scoped_ptr<DownloadTargetInfo> target_info; | 394 scoped_ptr<DownloadTargetInfo> target_info; |
395 base::RunLoop run_loop; | 395 base::RunLoop run_loop; |
396 DownloadTargetDeterminer::Start( | 396 DownloadTargetDeterminer::Start( |
397 item, initial_virtual_path, download_prefs_.get(), delegate(), | 397 item, initial_virtual_path, download_prefs_.get(), delegate(), |
398 base::Bind(&CompletionCallbackWrapper, | 398 base::Bind(&CompletionCallbackWrapper, |
399 run_loop.QuitClosure(), | 399 run_loop.QuitClosure(), |
400 &target_info)); | 400 &target_info)); |
401 run_loop.Run(); | 401 run_loop.Run(); |
402 ::testing::Mock::VerifyAndClearExpectations(delegate()); | 402 ::testing::Mock::VerifyAndClearExpectations(delegate()); |
403 return target_info.Pass(); | 403 return target_info; |
404 } | 404 } |
405 | 405 |
406 void DownloadTargetDeterminerTest::RunTestCasesWithActiveItem( | 406 void DownloadTargetDeterminerTest::RunTestCasesWithActiveItem( |
407 const DownloadTestCase test_cases[], | 407 const DownloadTestCase test_cases[], |
408 size_t test_case_count) { | 408 size_t test_case_count) { |
409 for (size_t i = 0; i < test_case_count; ++i) { | 409 for (size_t i = 0; i < test_case_count; ++i) { |
410 scoped_ptr<content::MockDownloadItem> item( | 410 scoped_ptr<content::MockDownloadItem> item( |
411 CreateActiveDownloadItem(i, test_cases[i])); | 411 CreateActiveDownloadItem(i, test_cases[i])); |
412 SCOPED_TRACE(testing::Message() << "Running test case " << i); | 412 SCOPED_TRACE(testing::Message() << "Running test case " << i); |
413 RunTestCase(test_cases[i], base::FilePath(), item.get()); | 413 RunTestCase(test_cases[i], base::FilePath(), item.get()); |
(...skipping 1830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2244 EXPECT_CALL(mock_plugin_filter_, MockPluginAvailable(npapi_plugin.path())) | 2244 EXPECT_CALL(mock_plugin_filter_, MockPluginAvailable(npapi_plugin.path())) |
2245 .WillRepeatedly(Return(true)); | 2245 .WillRepeatedly(Return(true)); |
2246 | 2246 |
2247 target_info = RunDownloadTargetDeterminer( | 2247 target_info = RunDownloadTargetDeterminer( |
2248 GetPathInDownloadDir(kInitialPath), item.get()); | 2248 GetPathInDownloadDir(kInitialPath), item.get()); |
2249 EXPECT_FALSE(target_info->is_filetype_handled_safely); | 2249 EXPECT_FALSE(target_info->is_filetype_handled_safely); |
2250 } | 2250 } |
2251 #endif // defined(ENABLE_PLUGINS) | 2251 #endif // defined(ENABLE_PLUGINS) |
2252 | 2252 |
2253 } // namespace | 2253 } // namespace |
OLD | NEW |