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

Side by Side Diff: webkit/browser/chromeos/fileapi/cros_mount_point_provider_unittest.cc

Issue 16010006: Move webkit/chromeos into webkit/browser/chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "webkit/chromeos/fileapi/cros_mount_point_provider.h" 5 #include "webkit/browser/chromeos/fileapi/cros_mount_point_provider.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "chromeos/dbus/cros_disks_client.h" 10 #include "chromeos/dbus/cros_disks_client.h"
11 #include "googleurl/src/url_util.h" 11 #include "googleurl/src/url_util.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "webkit/browser/fileapi/external_mount_points.h" 13 #include "webkit/browser/fileapi/external_mount_points.h"
14 #include "webkit/browser/fileapi/file_permission_policy.h" 14 #include "webkit/browser/fileapi/file_permission_policy.h"
15 #include "webkit/browser/fileapi/file_system_url.h" 15 #include "webkit/browser/fileapi/file_system_url.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 system_mount_points.get()), 165 system_mount_points.get()),
166 kPermission)); 166 kPermission));
167 EXPECT_EQ( 167 EXPECT_EQ(
168 fileapi::FILE_PERMISSION_ALWAYS_DENY, 168 fileapi::FILE_PERMISSION_ALWAYS_DENY,
169 provider.GetPermissionPolicy( 169 provider.GetPermissionPolicy(
170 CreateFileSystemURL(extension, "system/foo1", 170 CreateFileSystemURL(extension, "system/foo1",
171 system_mount_points.get()), 171 system_mount_points.get()),
172 kPermission)); 172 kPermission));
173 173
174 // oem is restricted file system. 174 // oem is restricted file system.
175 provider.GrantFileAccessToExtension(extension, base::FilePath(FPL("oem/foo"))) ; 175 provider.GrantFileAccessToExtension(
176 extension, base::FilePath(FPL("oem/foo")));
176 // The extension should not be able to access the file even if 177 // The extension should not be able to access the file even if
177 // GrantFileAccessToExtension was called. 178 // GrantFileAccessToExtension was called.
178 EXPECT_EQ( 179 EXPECT_EQ(
179 fileapi::FILE_PERMISSION_ALWAYS_DENY, 180 fileapi::FILE_PERMISSION_ALWAYS_DENY,
180 provider.GetPermissionPolicy( 181 provider.GetPermissionPolicy(
181 CreateFileSystemURL(extension, "oem/foo", mount_points.get()), 182 CreateFileSystemURL(extension, "oem/foo", mount_points.get()),
182 kPermission)); 183 kPermission));
183 184
184 provider.GrantFullAccessToExtension(extension); 185 provider.GrantFullAccessToExtension(extension);
185 // The extension should be able to access restricted file system after it was 186 // The extension should be able to access restricted file system after it was
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 mount_points->RegisterFileSystem("b", type, base::FilePath(FPL("/a/b")))); 251 mount_points->RegisterFileSystem("b", type, base::FilePath(FPL("/a/b"))));
251 ASSERT_TRUE( 252 ASSERT_TRUE(
252 mount_points->RegisterFileSystem("y", type, base::FilePath(FPL("/z/y")))); 253 mount_points->RegisterFileSystem("y", type, base::FilePath(FPL("/z/y"))));
253 ASSERT_TRUE( 254 ASSERT_TRUE(
254 mount_points->RegisterFileSystem("n", type, base::FilePath(FPL("/m/n")))); 255 mount_points->RegisterFileSystem("n", type, base::FilePath(FPL("/m/n"))));
255 256
256 // System mount points 257 // System mount points
257 ASSERT_TRUE(system_mount_points->RegisterFileSystem( 258 ASSERT_TRUE(system_mount_points->RegisterFileSystem(
258 "gb", type, base::FilePath(FPL("/a/b")))); 259 "gb", type, base::FilePath(FPL("/a/b"))));
259 ASSERT_TRUE( 260 ASSERT_TRUE(
260 system_mount_points->RegisterFileSystem("gz", type, base::FilePath(FPL("/z ")))); 261 system_mount_points->RegisterFileSystem(
262 "gz", type, base::FilePath(FPL("/z"))));
261 ASSERT_TRUE(system_mount_points->RegisterFileSystem( 263 ASSERT_TRUE(system_mount_points->RegisterFileSystem(
262 "gp", type, base::FilePath(FPL("/m/n/o/p")))); 264 "gp", type, base::FilePath(FPL("/m/n/o/p"))));
263 265
264 struct TestCase { 266 struct TestCase {
265 const base::FilePath::CharType* const local_path; 267 const base::FilePath::CharType* const local_path;
266 bool success; 268 bool success;
267 const base::FilePath::CharType* const virtual_path; 269 const base::FilePath::CharType* const virtual_path;
268 }; 270 };
269 271
270 const TestCase kTestCases[] = { 272 const TestCase kTestCases[] = {
(...skipping 22 matching lines...) Expand all
293 if (!kTestCases[i].success) 295 if (!kTestCases[i].success)
294 continue; 296 continue;
295 297
296 base::FilePath expected_virtual_path(kTestCases[i].virtual_path); 298 base::FilePath expected_virtual_path(kTestCases[i].virtual_path);
297 EXPECT_EQ(expected_virtual_path, virtual_path) 299 EXPECT_EQ(expected_virtual_path, virtual_path)
298 << "Resolving " << kTestCases[i].local_path; 300 << "Resolving " << kTestCases[i].local_path;
299 } 301 }
300 } 302 }
301 303
302 } // namespace 304 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698