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

Side by Side Diff: chrome/browser/chromeos/fileapi/file_access_permissions_unittest.cc

Issue 148233008: Grant Files.app access for mount points added after its launch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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 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 "chrome/browser/chromeos/fileapi/file_access_permissions.h" 5 #include "chrome/browser/chromeos/fileapi/file_access_permissions.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace chromeos { 9 namespace chromeos {
10 10
(...skipping 29 matching lines...) Expand all
40 // After granting file access to the handler extension for a given directory, 40 // After granting file access to the handler extension for a given directory,
41 // it can access that directory and all files within it. 41 // it can access that directory and all files within it.
42 permissions.GrantAccessPermission(extension2, good_dir); 42 permissions.GrantAccessPermission(extension2, good_dir);
43 EXPECT_FALSE(permissions.HasAccessPermission(extension1, good_dir)); 43 EXPECT_FALSE(permissions.HasAccessPermission(extension1, good_dir));
44 EXPECT_TRUE(permissions.HasAccessPermission(extension1, good_file)); 44 EXPECT_TRUE(permissions.HasAccessPermission(extension1, good_file));
45 EXPECT_FALSE(permissions.HasAccessPermission(extension1, bad_file)); 45 EXPECT_FALSE(permissions.HasAccessPermission(extension1, bad_file));
46 EXPECT_TRUE(permissions.HasAccessPermission(extension2, good_dir)); 46 EXPECT_TRUE(permissions.HasAccessPermission(extension2, good_dir));
47 EXPECT_TRUE(permissions.HasAccessPermission(extension2, good_file)); 47 EXPECT_TRUE(permissions.HasAccessPermission(extension2, good_file));
48 EXPECT_TRUE(permissions.HasAccessPermission(extension2, bad_file)); 48 EXPECT_TRUE(permissions.HasAccessPermission(extension2, bad_file));
49 49
50 // After granting full access, it can access all directories and files.
51 permissions.GrantFullAccessPermission(extension1);
52 EXPECT_TRUE(permissions.HasAccessPermission(extension1, good_dir));
53 EXPECT_TRUE(permissions.HasAccessPermission(extension1, good_file));
54 EXPECT_TRUE(permissions.HasAccessPermission(extension1, bad_file));
55
50 // After revoking rights for extensions, they should not be able to access 56 // After revoking rights for extensions, they should not be able to access
51 // any file system element anymore. 57 // any file system element anymore.
52 permissions.RevokePermissions(extension1); 58 permissions.RevokePermissions(extension1);
53 permissions.RevokePermissions(extension2); 59 permissions.RevokePermissions(extension2);
54 EXPECT_FALSE(permissions.HasAccessPermission(extension1, good_dir)); 60 EXPECT_FALSE(permissions.HasAccessPermission(extension1, good_dir));
55 EXPECT_FALSE(permissions.HasAccessPermission(extension1, good_file)); 61 EXPECT_FALSE(permissions.HasAccessPermission(extension1, good_file));
56 EXPECT_FALSE(permissions.HasAccessPermission(extension1, bad_file)); 62 EXPECT_FALSE(permissions.HasAccessPermission(extension1, bad_file));
57 EXPECT_FALSE(permissions.HasAccessPermission(extension2, good_dir)); 63 EXPECT_FALSE(permissions.HasAccessPermission(extension2, good_dir));
58 EXPECT_FALSE(permissions.HasAccessPermission(extension2, good_file)); 64 EXPECT_FALSE(permissions.HasAccessPermission(extension2, good_file));
59 EXPECT_FALSE(permissions.HasAccessPermission(extension2, bad_file)); 65 EXPECT_FALSE(permissions.HasAccessPermission(extension2, bad_file));
60 } 66 }
61 67
62 } // namespace chromeos 68 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/fileapi/file_access_permissions.cc ('k') | chrome/browser/chromeos/fileapi/file_system_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698