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

Side by Side Diff: webkit/chromeos/fileapi/file_access_permissions_unittest.cc

Issue 12163003: Add FilePath to base namespace. (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/chromeos/fileapi/file_access_permissions.h" 5 #include "webkit/chromeos/fileapi/file_access_permissions.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 8
9 class FileAccessPermissionsTest : public testing::Test { 9 class FileAccessPermissionsTest : public testing::Test {
10 }; 10 };
11 11
12 TEST_F(FileAccessPermissionsTest, FileAccessChecks) { 12 TEST_F(FileAccessPermissionsTest, FileAccessChecks) {
13 #if defined(OS_WIN) 13 #if defined(OS_WIN)
14 FilePath good_dir(FILE_PATH_LITERAL("c:\\root\\dir")); 14 base::FilePath good_dir(FILE_PATH_LITERAL("c:\\root\\dir"));
15 FilePath bad_dir(FILE_PATH_LITERAL("c:\\root")); 15 base::FilePath bad_dir(FILE_PATH_LITERAL("c:\\root"));
16 FilePath good_file(FILE_PATH_LITERAL("c:\\root\\dir\\good_file.txt")); 16 base::FilePath good_file(FILE_PATH_LITERAL("c:\\root\\dir\\good_file.txt"));
17 FilePath bad_file(FILE_PATH_LITERAL("c:\\root\\dir\\bad_file.txt")); 17 base::FilePath bad_file(FILE_PATH_LITERAL("c:\\root\\dir\\bad_file.txt"));
18 #elif defined(OS_POSIX) 18 #elif defined(OS_POSIX)
19 FilePath good_dir(FILE_PATH_LITERAL("/root/dir")); 19 base::FilePath good_dir(FILE_PATH_LITERAL("/root/dir"));
20 FilePath bad_dir(FILE_PATH_LITERAL("/root")); 20 base::FilePath bad_dir(FILE_PATH_LITERAL("/root"));
21 FilePath good_file(FILE_PATH_LITERAL("/root/dir/good_file.txt")); 21 base::FilePath good_file(FILE_PATH_LITERAL("/root/dir/good_file.txt"));
22 FilePath bad_file(FILE_PATH_LITERAL("/root/dir/bad_file.txt")); 22 base::FilePath bad_file(FILE_PATH_LITERAL("/root/dir/bad_file.txt"));
23 #endif 23 #endif
24 std::string extension1("ddammdhioacbehjngdmkjcjbnfginlla"); 24 std::string extension1("ddammdhioacbehjngdmkjcjbnfginlla");
25 std::string extension2("jkhdjkhkhsdkfhsdkhrterwmtermeter"); 25 std::string extension2("jkhdjkhkhsdkfhsdkhrterwmtermeter");
26 26
27 chromeos::FileAccessPermissions permissions; 27 chromeos::FileAccessPermissions permissions;
28 // By default extension have no access to any local file. 28 // By default extension have no access to any local file.
29 EXPECT_FALSE(permissions.HasAccessPermission(extension1, good_dir)); 29 EXPECT_FALSE(permissions.HasAccessPermission(extension1, good_dir));
30 EXPECT_FALSE(permissions.HasAccessPermission(extension1, good_file)); 30 EXPECT_FALSE(permissions.HasAccessPermission(extension1, good_file));
31 EXPECT_FALSE(permissions.HasAccessPermission(extension1, bad_file)); 31 EXPECT_FALSE(permissions.HasAccessPermission(extension1, bad_file));
32 EXPECT_FALSE(permissions.HasAccessPermission(extension2, good_dir)); 32 EXPECT_FALSE(permissions.HasAccessPermission(extension2, good_dir));
(...skipping 25 matching lines...) Expand all
58 // any file system element anymore. 58 // any file system element anymore.
59 permissions.RevokePermissions(extension1); 59 permissions.RevokePermissions(extension1);
60 permissions.RevokePermissions(extension2); 60 permissions.RevokePermissions(extension2);
61 EXPECT_FALSE(permissions.HasAccessPermission(extension1, good_dir)); 61 EXPECT_FALSE(permissions.HasAccessPermission(extension1, good_dir));
62 EXPECT_FALSE(permissions.HasAccessPermission(extension1, good_file)); 62 EXPECT_FALSE(permissions.HasAccessPermission(extension1, good_file));
63 EXPECT_FALSE(permissions.HasAccessPermission(extension1, bad_file)); 63 EXPECT_FALSE(permissions.HasAccessPermission(extension1, bad_file));
64 EXPECT_FALSE(permissions.HasAccessPermission(extension2, good_dir)); 64 EXPECT_FALSE(permissions.HasAccessPermission(extension2, good_dir));
65 EXPECT_FALSE(permissions.HasAccessPermission(extension2, good_file)); 65 EXPECT_FALSE(permissions.HasAccessPermission(extension2, good_file));
66 EXPECT_FALSE(permissions.HasAccessPermission(extension2, bad_file)); 66 EXPECT_FALSE(permissions.HasAccessPermission(extension2, bad_file));
67 } 67 }
OLDNEW
« no previous file with comments | « webkit/chromeos/fileapi/file_access_permissions.cc ('k') | webkit/chromeos/fileapi/file_util_async.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698