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

Side by Side Diff: content/browser/fileapi/sandbox_file_system_backend_delegate_unittest.cc

Issue 1488873002: Revert "Treat '...' as a non-parent path component outside of Windows." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « base/files/file_path_unittest.cc ('k') | third_party/WebKit/LayoutTests/TestExpectations » ('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 "storage/browser/fileapi/sandbox_file_system_backend_delegate.h" 5 #include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/thread_task_runner_handle.h" 11 #include "base/thread_task_runner_handle.h"
12 #include "build/build_config.h"
13 #include "content/public/test/test_file_system_options.h" 12 #include "content/public/test/test_file_system_options.h"
14 #include "storage/browser/fileapi/file_system_url.h" 13 #include "storage/browser/fileapi/file_system_url.h"
15 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
16 #include "url/gurl.h" 15 #include "url/gurl.h"
17 16
18 using storage::FileSystemURL; 17 using storage::FileSystemURL;
19 18
20 namespace content { 19 namespace content {
21 20
22 namespace { 21 namespace {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // Access from non-allowed scheme should be disallowed. 59 // Access from non-allowed scheme should be disallowed.
61 EXPECT_FALSE(IsAccessValid( 60 EXPECT_FALSE(IsAccessValid(
62 FileSystemURL::CreateForTest(GURL("unknown://bar"), 61 FileSystemURL::CreateForTest(GURL("unknown://bar"),
63 storage::kFileSystemTypeTemporary, 62 storage::kFileSystemTypeTemporary,
64 base::FilePath::FromUTF8Unsafe("foo")))); 63 base::FilePath::FromUTF8Unsafe("foo"))));
65 64
66 // Access with restricted name should be disallowed. 65 // Access with restricted name should be disallowed.
67 EXPECT_FALSE(IsAccessValid(CreateFileSystemURL("."))); 66 EXPECT_FALSE(IsAccessValid(CreateFileSystemURL(".")));
68 EXPECT_FALSE(IsAccessValid(CreateFileSystemURL(".."))); 67 EXPECT_FALSE(IsAccessValid(CreateFileSystemURL("..")));
69 68
70 #if defined(OS_WIN)
71 // This is also disallowed due to Windows XP parent path handling. 69 // This is also disallowed due to Windows XP parent path handling.
72 EXPECT_FALSE(IsAccessValid(CreateFileSystemURL("..."))); 70 EXPECT_FALSE(IsAccessValid(CreateFileSystemURL("...")));
73 71
74 // These are identified as unsafe cases due to weird path handling 72 // These are identified as unsafe cases due to weird path handling
75 // on Windows. 73 // on Windows.
76 EXPECT_FALSE(IsAccessValid(CreateFileSystemURL(" .."))); 74 EXPECT_FALSE(IsAccessValid(CreateFileSystemURL(" ..")));
77 EXPECT_FALSE(IsAccessValid(CreateFileSystemURL(".. "))); 75 EXPECT_FALSE(IsAccessValid(CreateFileSystemURL(".. ")));
78 #else
79 EXPECT_TRUE(IsAccessValid(CreateFileSystemURL("...")));
80 EXPECT_TRUE(IsAccessValid(CreateFileSystemURL(" ..")));
81 EXPECT_TRUE(IsAccessValid(CreateFileSystemURL(".. ")));
82 #endif
83 76
84 // Similar but safe cases. 77 // Similar but safe cases.
85 EXPECT_TRUE(IsAccessValid(CreateFileSystemURL(" ."))); 78 EXPECT_TRUE(IsAccessValid(CreateFileSystemURL(" .")));
86 EXPECT_TRUE(IsAccessValid(CreateFileSystemURL(". "))); 79 EXPECT_TRUE(IsAccessValid(CreateFileSystemURL(". ")));
87 EXPECT_TRUE(IsAccessValid(CreateFileSystemURL("b."))); 80 EXPECT_TRUE(IsAccessValid(CreateFileSystemURL("b.")));
88 EXPECT_TRUE(IsAccessValid(CreateFileSystemURL(".b"))); 81 EXPECT_TRUE(IsAccessValid(CreateFileSystemURL(".b")));
89 82
90 // A path that looks like a drive letter. 83 // A path that looks like a drive letter.
91 EXPECT_TRUE(IsAccessValid(CreateFileSystemURL("c:"))); 84 EXPECT_TRUE(IsAccessValid(CreateFileSystemURL("c:")));
92 } 85 }
93 86
94 } // namespace content 87 } // namespace content
OLDNEW
« no previous file with comments | « base/files/file_path_unittest.cc ('k') | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698