OLD | NEW |
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 }; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 EXPECT_FALSE(permissions.HasAccessPermission(extension2, good_file)); | 43 EXPECT_FALSE(permissions.HasAccessPermission(extension2, good_file)); |
44 EXPECT_FALSE(permissions.HasAccessPermission(extension2, bad_file)); | 44 EXPECT_FALSE(permissions.HasAccessPermission(extension2, bad_file)); |
45 | 45 |
46 | 46 |
47 // After granting file access to the handler extension for a given directory, | 47 // After granting file access to the handler extension for a given directory, |
48 // it can access that directory and all files within it. | 48 // it can access that directory and all files within it. |
49 permissions.GrantAccessPermission(extension2, good_dir); | 49 permissions.GrantAccessPermission(extension2, good_dir); |
50 EXPECT_FALSE(permissions.HasAccessPermission(extension1, good_dir)); | 50 EXPECT_FALSE(permissions.HasAccessPermission(extension1, good_dir)); |
51 EXPECT_TRUE(permissions.HasAccessPermission(extension1, good_file)); | 51 EXPECT_TRUE(permissions.HasAccessPermission(extension1, good_file)); |
52 EXPECT_FALSE(permissions.HasAccessPermission(extension1, bad_file)); | 52 EXPECT_FALSE(permissions.HasAccessPermission(extension1, bad_file)); |
53 EXPECT_FALSE(permissions.HasAccessPermission(extension2, good_dir)); | 53 EXPECT_TRUE(permissions.HasAccessPermission(extension2, good_dir)); |
54 EXPECT_FALSE(permissions.HasAccessPermission(extension2, good_file)); | 54 EXPECT_TRUE(permissions.HasAccessPermission(extension2, good_file)); |
55 EXPECT_FALSE(permissions.HasAccessPermission(extension2, bad_file)); | 55 EXPECT_TRUE(permissions.HasAccessPermission(extension2, bad_file)); |
56 | 56 |
57 // After revoking rights for extensions, they should not be able to access | 57 // After revoking rights for extensions, they should not be able to access |
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 } |
OLD | NEW |