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

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

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

Powered by Google App Engine
This is Rietveld 408576698