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

Side by Side Diff: webkit/fileapi/isolated_context_unittest.cc

Issue 10540070: Make Isolated file system writable only if it is configured so (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added writer wiring for sandbox and test mpp Created 8 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
« no previous file with comments | « webkit/fileapi/isolated_context.cc ('k') | webkit/fileapi/isolated_mount_point_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/fileapi/isolated_context.h" 5 #include "webkit/fileapi/isolated_context.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 ASSERT_EQ(id_, cracked_id); 158 ASSERT_EQ(id_, cracked_id);
159 159
160 // Trying to crack "/foo" should fail (because "foo" is not the one 160 // Trying to crack "/foo" should fail (because "foo" is not the one
161 // included in the kTestPaths). 161 // included in the kTestPaths).
162 virtual_path = isolated_context()->CreateVirtualPath( 162 virtual_path = isolated_context()->CreateVirtualPath(
163 id_, FilePath(FPL("foo"))); 163 id_, FilePath(FPL("foo")));
164 ASSERT_FALSE(isolated_context()->CrackIsolatedPath( 164 ASSERT_FALSE(isolated_context()->CrackIsolatedPath(
165 virtual_path, &cracked_id, &root_path, &cracked_path)); 165 virtual_path, &cracked_id, &root_path, &cracked_path));
166 } 166 }
167 167
168 TEST_F(IsolatedContextTest, Writable) {
169 // By default the file system must be read-only.
170 ASSERT_FALSE(isolated_context()->IsWritable(id_));
171
172 // Set writable.
173 ASSERT_TRUE(isolated_context()->SetWritable(id_, true));
174 ASSERT_TRUE(isolated_context()->IsWritable(id_));
175
176 // Set non-writable.
177 ASSERT_TRUE(isolated_context()->SetWritable(id_, false));
178 ASSERT_FALSE(isolated_context()->IsWritable(id_));
179
180 // Set writable again, and revoke the filesystem.
181 ASSERT_TRUE(isolated_context()->SetWritable(id_, true));
182 isolated_context()->RevokeIsolatedFileSystem(id_);
183
184 // IsWritable should return false for non-registered file system.
185 ASSERT_FALSE(isolated_context()->IsWritable(id_));
186 // SetWritable should also return false for non-registered file system
187 // (no matter what value we give).
188 ASSERT_FALSE(isolated_context()->SetWritable(id_, true));
189 ASSERT_FALSE(isolated_context()->SetWritable(id_, false));
190 }
191
168 } // namespace fileapi 192 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/isolated_context.cc ('k') | webkit/fileapi/isolated_mount_point_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698