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

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

Issue 14625016: downloads: Make GetCrDownloadPath a static method on DownloadTargetDeterminer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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/observer_list.h" 8 #include "base/observer_list.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 content::DownloadDangerType danger_type, 403 content::DownloadDangerType danger_type,
404 const base::FilePath& intermediate_path) { 404 const base::FilePath& intermediate_path) {
405 base::FilePath expected_local_path( 405 base::FilePath expected_local_path(
406 GetPathInDownloadDir(test_case.expected_local_path)); 406 GetPathInDownloadDir(test_case.expected_local_path));
407 EXPECT_EQ(expected_local_path.value(), local_path.value()); 407 EXPECT_EQ(expected_local_path.value(), local_path.value());
408 EXPECT_EQ(test_case.expected_disposition, disposition); 408 EXPECT_EQ(test_case.expected_disposition, disposition);
409 EXPECT_EQ(test_case.expected_danger_type, danger_type); 409 EXPECT_EQ(test_case.expected_danger_type, danger_type);
410 410
411 switch (test_case.expected_intermediate) { 411 switch (test_case.expected_intermediate) {
412 case EXPECT_CRDOWNLOAD: 412 case EXPECT_CRDOWNLOAD:
413 EXPECT_EQ(download_util::GetCrDownloadPath(local_path).value(), 413 EXPECT_EQ(DownloadTargetDeterminer::GetCrDownloadPath(local_path).value(),
414 intermediate_path.value()); 414 intermediate_path.value());
415 break; 415 break;
416 416
417 case EXPECT_UNCONFIRMED: 417 case EXPECT_UNCONFIRMED:
418 // The paths (in English) look like: /path/Unconfirmed xxx.crdownload. 418 // The paths (in English) look like: /path/Unconfirmed xxx.crdownload.
419 // Of this, we only check that the path is: 419 // Of this, we only check that the path is:
420 // 1. Not "/path/target.crdownload", 420 // 1. Not "/path/target.crdownload",
421 // 2. Points to the same directory as the target. 421 // 2. Points to the same directory as the target.
422 // 3. Has extension ".crdownload". 422 // 3. Has extension ".crdownload".
423 // 4. Basename starts with "Unconfirmed ". 423 // 4. Basename starts with "Unconfirmed ".
424 EXPECT_NE(download_util::GetCrDownloadPath(expected_local_path).value(), 424 EXPECT_NE(DownloadTargetDeterminer::GetCrDownloadPath(expected_local_path)
425 .value(),
425 intermediate_path.value()); 426 intermediate_path.value());
426 EXPECT_EQ(expected_local_path.DirName().value(), 427 EXPECT_EQ(expected_local_path.DirName().value(),
427 intermediate_path.DirName().value()); 428 intermediate_path.DirName().value());
428 EXPECT_TRUE(intermediate_path.MatchesExtension( 429 EXPECT_TRUE(intermediate_path.MatchesExtension(
429 FILE_PATH_LITERAL(".crdownload"))); 430 FILE_PATH_LITERAL(".crdownload")));
430 EXPECT_EQ(0u, intermediate_path.BaseName().value().find( 431 EXPECT_EQ(0u, intermediate_path.BaseName().value().find(
431 FILE_PATH_LITERAL("Unconfirmed "))); 432 FILE_PATH_LITERAL("Unconfirmed ")));
432 break; 433 break;
433 434
434 case EXPECT_LOCAL_PATH: 435 case EXPECT_LOCAL_PATH:
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after
1471 .WillOnce(WithArg<2>( 1472 .WillOnce(WithArg<2>(
1472 ScheduleCallback2(overridden_path, 1473 ScheduleCallback2(overridden_path,
1473 DownloadPathReservationTracker::UNIQUIFY))); 1474 DownloadPathReservationTracker::UNIQUIFY)));
1474 EXPECT_CALL(*delegate(), 1475 EXPECT_CALL(*delegate(),
1475 PromptUserForDownloadPath(_, full_overridden_path, _)) 1476 PromptUserForDownloadPath(_, full_overridden_path, _))
1476 .WillOnce(WithArg<2>( 1477 .WillOnce(WithArg<2>(
1477 ScheduleCallback(full_overridden_path))); 1478 ScheduleCallback(full_overridden_path)));
1478 RunTestCase(test_case, item.get()); 1479 RunTestCase(test_case, item.get());
1479 } 1480 }
1480 } // namespace 1481 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/download/download_target_determiner.cc ('k') | chrome/browser/download/download_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698