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

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

Issue 9320059: Define FilePath::NormalizePathSeparators on all platforms (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix Created 8 years, 10 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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 }; 774 };
775 775
776 FilePath ExpandFilenameTestPath(const FilePath::CharType* template_path, 776 FilePath ExpandFilenameTestPath(const FilePath::CharType* template_path,
777 const FilePath& downloads_dir, 777 const FilePath& downloads_dir,
778 const FilePath& alternate_dir) { 778 const FilePath& alternate_dir) {
779 FilePath::StringType path(template_path); 779 FilePath::StringType path(template_path);
780 ReplaceSubstringsAfterOffset(&path, 0, FILE_PATH_LITERAL("$dl"), 780 ReplaceSubstringsAfterOffset(&path, 0, FILE_PATH_LITERAL("$dl"),
781 downloads_dir.value()); 781 downloads_dir.value());
782 ReplaceSubstringsAfterOffset(&path, 0, FILE_PATH_LITERAL("$alt"), 782 ReplaceSubstringsAfterOffset(&path, 0, FILE_PATH_LITERAL("$alt"),
783 alternate_dir.value()); 783 alternate_dir.value());
784 FilePath file_path(path); 784 return FilePath(path).NormalizePathSeparators();
785 #if defined(FILE_PATH_USES_WIN_SEPARATORS)
786 file_path = file_path.NormalizeWindowsPathSeparators();
787 #endif
788 return file_path;
789 } 785 }
790 786
791 } // namespace 787 } // namespace
792 788
793 TEST_F(DownloadManagerTest, DownloadFilenameTest) { 789 TEST_F(DownloadManagerTest, DownloadFilenameTest) {
794 ScopedTempDir scoped_dl_dir; 790 ScopedTempDir scoped_dl_dir;
795 ASSERT_TRUE(scoped_dl_dir.CreateUniqueTempDir()); 791 ASSERT_TRUE(scoped_dl_dir.CreateUniqueTempDir());
796 792
797 FilePath downloads_dir(scoped_dl_dir.path()); 793 FilePath downloads_dir(scoped_dl_dir.path());
798 FilePath alternate_dir(downloads_dir.Append(FILE_PATH_LITERAL("Foo"))); 794 FilePath alternate_dir(downloads_dir.Append(FILE_PATH_LITERAL("Foo")));
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 EXPECT_FALSE(observer->hit_state(DownloadItem::INTERRUPTED)); 1303 EXPECT_FALSE(observer->hit_state(DownloadItem::INTERRUPTED));
1308 EXPECT_TRUE(observer->hit_state(DownloadItem::COMPLETE)); 1304 EXPECT_TRUE(observer->hit_state(DownloadItem::COMPLETE));
1309 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING)); 1305 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING));
1310 EXPECT_TRUE(observer->was_updated()); 1306 EXPECT_TRUE(observer->was_updated());
1311 EXPECT_FALSE(observer->was_opened()); 1307 EXPECT_FALSE(observer->was_opened());
1312 EXPECT_TRUE(download->GetFileExternallyRemoved()); 1308 EXPECT_TRUE(download->GetFileExternallyRemoved());
1313 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); 1309 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState());
1314 1310
1315 EXPECT_FALSE(file_util::PathExists(new_path)); 1311 EXPECT_FALSE(file_util::PathExists(new_path));
1316 } 1312 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/extensions/extension_icon_source.cc ('k') | webkit/fileapi/file_system_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698