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

Unified Diff: content/browser/child_process_security_policy_unittest.cc

Issue 12213066: Use base namespace for FilePath in content/browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/child_process_security_policy_unittest.cc
diff --git a/content/browser/child_process_security_policy_unittest.cc b/content/browser/child_process_security_policy_unittest.cc
index e98b8411c6024d18cc54aadeaf23f444c6132498..9b9f4b41028399aa34b882b9fb18e42521f54fac 100644
--- a/content/browser/child_process_security_policy_unittest.cc
+++ b/content/browser/child_process_security_policy_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+base::// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -300,16 +300,21 @@ TEST_F(ChildProcessSecurityPolicyTest, CanReadFiles) {
p->Add(kRendererID);
- EXPECT_FALSE(p->CanReadFile(kRendererID, FilePath(TEST_PATH("/etc/passwd"))));
- p->GrantReadFile(kRendererID, FilePath(TEST_PATH("/etc/passwd")));
- EXPECT_TRUE(p->CanReadFile(kRendererID, FilePath(TEST_PATH("/etc/passwd"))));
- EXPECT_FALSE(p->CanReadFile(kRendererID, FilePath(TEST_PATH("/etc/shadow"))));
+ EXPECT_FALSE(p->CanReadFile(kRendererID,
+ base::FilePath(TEST_PATH("/etc/passwd"))));
+ p->GrantReadFile(kRendererID, base::FilePath(TEST_PATH("/etc/passwd")));
+ EXPECT_TRUE(p->CanReadFile(kRendererID,
+ base::FilePath(TEST_PATH("/etc/passwd"))));
+ EXPECT_FALSE(p->CanReadFile(kRendererID,
+ base::FilePath(TEST_PATH("/etc/shadow"))));
p->Remove(kRendererID);
p->Add(kRendererID);
- EXPECT_FALSE(p->CanReadFile(kRendererID, FilePath(TEST_PATH("/etc/passwd"))));
- EXPECT_FALSE(p->CanReadFile(kRendererID, FilePath(TEST_PATH("/etc/shadow"))));
+ EXPECT_FALSE(p->CanReadFile(kRendererID,
+ base::FilePath(TEST_PATH("/etc/passwd"))));
+ EXPECT_FALSE(p->CanReadFile(kRendererID,
+ base::FilePath(TEST_PATH("/etc/shadow"))));
p->Remove(kRendererID);
}
@@ -320,40 +325,49 @@ TEST_F(ChildProcessSecurityPolicyTest, CanReadDirectories) {
p->Add(kRendererID);
- EXPECT_FALSE(p->CanReadDirectory(kRendererID, FilePath(TEST_PATH("/etc/"))));
- p->GrantReadDirectory(kRendererID, FilePath(TEST_PATH("/etc/")));
- EXPECT_TRUE(p->CanReadDirectory(kRendererID, FilePath(TEST_PATH("/etc/"))));
- EXPECT_TRUE(p->CanReadFile(kRendererID, FilePath(TEST_PATH("/etc/passwd"))));
+ EXPECT_FALSE(p->CanReadDirectory(kRendererID,
+ base::FilePath(TEST_PATH("/etc/"))));
+ p->GrantReadDirectory(kRendererID,
+ base::FilePath(TEST_PATH("/etc/")));
+ EXPECT_TRUE(p->CanReadDirectory(kRendererID,
+ base::FilePath(TEST_PATH("/etc/"))));
+ EXPECT_TRUE(p->CanReadFile(kRendererID,
+ base::FilePath(TEST_PATH("/etc/passwd"))));
p->Remove(kRendererID);
p->Add(kRendererID);
- EXPECT_FALSE(p->CanReadDirectory(kRendererID, FilePath(TEST_PATH("/etc/"))));
- EXPECT_FALSE(p->CanReadFile(kRendererID, FilePath(TEST_PATH("/etc/passwd"))));
+ EXPECT_FALSE(p->CanReadDirectory(kRendererID,
+ base::FilePath(TEST_PATH("/etc/"))));
+ EXPECT_FALSE(p->CanReadFile(kRendererID,
+ base::FilePath(TEST_PATH("/etc/passwd"))));
// Just granting read permission as a file doesn't imply reading as a
// directory.
- p->GrantReadFile(kRendererID, FilePath(TEST_PATH("/etc/")));
- EXPECT_TRUE(p->CanReadFile(kRendererID, FilePath(TEST_PATH("/etc/passwd"))));
- EXPECT_FALSE(p->CanReadDirectory(kRendererID, FilePath(TEST_PATH("/etc/"))));
+ p->GrantReadFile(kRendererID, base::FilePath(TEST_PATH("/etc/")));
+ EXPECT_TRUE(p->CanReadFile(kRendererID,
+ base::FilePath(TEST_PATH("/etc/passwd"))));
+ EXPECT_FALSE(p->CanReadDirectory(kRendererID,
+ base::FilePath(TEST_PATH("/etc/"))));
p->Remove(kRendererID);
}
TEST_F(ChildProcessSecurityPolicyTest, FilePermissions) {
- FilePath granted_file = FilePath(TEST_PATH("/home/joe"));
- FilePath sibling_file = FilePath(TEST_PATH("/home/bob"));
- FilePath child_file = FilePath(TEST_PATH("/home/joe/file"));
- FilePath parent_file = FilePath(TEST_PATH("/home"));
- FilePath parent_slash_file = FilePath(TEST_PATH("/home/"));
- FilePath child_traversal1 = FilePath(TEST_PATH("/home/joe/././file"));
- FilePath child_traversal2 = FilePath(
+ base::FilePath granted_file = FilePath(TEST_PATH("/home/joe"));
+ base::FilePath sibling_file = FilePath(TEST_PATH("/home/bob"));
+ base::FilePath child_file = FilePath(TEST_PATH("/home/joe/file"));
+ base::FilePath parent_file = FilePath(TEST_PATH("/home"));
+ base::FilePath parent_slash_file = FilePath(TEST_PATH("/home/"));
+ base::FilePath child_traversal1 = FilePath(TEST_PATH("/home/joe/././file"));
+ base::FilePath child_traversal2 = FilePath(
TEST_PATH("/home/joe/file/../otherfile"));
- FilePath evil_traversal1 = FilePath(TEST_PATH("/home/joe/../../etc/passwd"));
- FilePath evil_traversal2 = FilePath(
+ base::FilePath evil_traversal1 =
+ FilePath(TEST_PATH("/home/joe/../../etc/passwd"));
+ base::FilePath evil_traversal2 = FilePath(
TEST_PATH("/home/joe/./.././../etc/passwd"));
- FilePath self_traversal = FilePath(TEST_PATH("/home/joe/../joe/file"));
- FilePath relative_file = FilePath(FILE_PATH_LITERAL("home/joe"));
+ base::FilePath self_traversal = FilePath(TEST_PATH("/home/joe/../joe/file"));
+ base::FilePath relative_file = FilePath(FILE_PATH_LITERAL("home/joe"));
ChildProcessSecurityPolicyImpl* p =
ChildProcessSecurityPolicyImpl::GetInstance();
@@ -510,7 +524,7 @@ TEST_F(ChildProcessSecurityPolicyTest, RemoveRace) {
ChildProcessSecurityPolicyImpl::GetInstance();
GURL url("file:///etc/passwd");
- FilePath file(TEST_PATH("/etc/passwd"));
+ base::FilePath file(TEST_PATH("/etc/passwd"));
p->Add(kRendererID);
« no previous file with comments | « content/browser/child_process_security_policy_impl.cc ('k') | content/browser/devtools/devtools_http_handler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698