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

Side by Side Diff: extensions/common/file_util_unittest.cc

Issue 100573002: Move directory creation functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
« no previous file with comments | « extensions/common/extension_resource_unittest.cc ('k') | ipc/ipc_channel_posix_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "extensions/common/file_util.h" 5 #include "extensions/common/file_util.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "url/gurl.h" 10 #include "url/gurl.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 TEST_F(FileUtilTest, ExtensionResourceURLToFilePath) { 56 TEST_F(FileUtilTest, ExtensionResourceURLToFilePath) {
57 // Setup filesystem for testing. 57 // Setup filesystem for testing.
58 base::FilePath root_path; 58 base::FilePath root_path;
59 ASSERT_TRUE(base::CreateNewTempDirectory( 59 ASSERT_TRUE(base::CreateNewTempDirectory(
60 base::FilePath::StringType(), &root_path)); 60 base::FilePath::StringType(), &root_path));
61 root_path = base::MakeAbsoluteFilePath(root_path); 61 root_path = base::MakeAbsoluteFilePath(root_path);
62 ASSERT_FALSE(root_path.empty()); 62 ASSERT_FALSE(root_path.empty());
63 63
64 base::FilePath api_path = root_path.Append(FILE_PATH_LITERAL("apiname")); 64 base::FilePath api_path = root_path.Append(FILE_PATH_LITERAL("apiname"));
65 ASSERT_TRUE(file_util::CreateDirectory(api_path)); 65 ASSERT_TRUE(base::CreateDirectory(api_path));
66 66
67 const char data[] = "Test Data"; 67 const char data[] = "Test Data";
68 base::FilePath resource_path = api_path.Append(FILE_PATH_LITERAL("test.js")); 68 base::FilePath resource_path = api_path.Append(FILE_PATH_LITERAL("test.js"));
69 ASSERT_TRUE(file_util::WriteFile(resource_path, data, sizeof(data))); 69 ASSERT_TRUE(file_util::WriteFile(resource_path, data, sizeof(data)));
70 resource_path = api_path.Append(FILE_PATH_LITERAL("escape spaces.js")); 70 resource_path = api_path.Append(FILE_PATH_LITERAL("escape spaces.js"));
71 ASSERT_TRUE(file_util::WriteFile(resource_path, data, sizeof(data))); 71 ASSERT_TRUE(file_util::WriteFile(resource_path, data, sizeof(data)));
72 72
73 #ifdef FILE_PATH_USES_WIN_SEPARATORS 73 #ifdef FILE_PATH_USES_WIN_SEPARATORS
74 #define SEP "\\" 74 #define SEP "\\"
75 #else 75 #else
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 expected_path = root_path.Append(FILE_PATH_LITERAL("apiname")).Append( 112 expected_path = root_path.Append(FILE_PATH_LITERAL("apiname")).Append(
113 test_cases[i].expected_path); 113 test_cases[i].expected_path);
114 base::FilePath actual_path = 114 base::FilePath actual_path =
115 extensions::file_util::ExtensionResourceURLToFilePath(url, root_path); 115 extensions::file_util::ExtensionResourceURLToFilePath(url, root_path);
116 EXPECT_EQ(expected_path.value(), actual_path.value()) << 116 EXPECT_EQ(expected_path.value(), actual_path.value()) <<
117 " For the path " << url; 117 " For the path " << url;
118 } 118 }
119 // Remove temp files. 119 // Remove temp files.
120 ASSERT_TRUE(base::DeleteFile(root_path, true)); 120 ASSERT_TRUE(base::DeleteFile(root_path, true));
121 } 121 }
OLDNEW
« no previous file with comments | « extensions/common/extension_resource_unittest.cc ('k') | ipc/ipc_channel_posix_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698