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

Side by Side Diff: chrome/browser/chromeos/extensions/external_filesystem_apitest.cc

Issue 10067021: Postpone setting up file handler's file permissions if handler is running lazy background page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 8 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) 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 "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/platform_file.h" 6 #include "base/platform_file.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/scoped_temp_dir.h" 8 #include "base/scoped_temp_dir.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h" 10 #include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h"
11 #include "chrome/browser/extensions/extension_apitest.h" 11 #include "chrome/browser/extensions/extension_apitest.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/common/chrome_switches.h"
14 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
15 #include "webkit/fileapi/file_system_context.h" 16 #include "webkit/fileapi/file_system_context.h"
16 #include "webkit/fileapi/file_system_mount_point_provider.h" 17 #include "webkit/fileapi/file_system_mount_point_provider.h"
17 #include "chrome/browser/chromeos/gdata/gdata_util.h" 18 #include "chrome/browser/chromeos/gdata/gdata_util.h"
18 #include "webkit/chromeos/fileapi/remote_file_system_proxy.h" 19 #include "webkit/chromeos/fileapi/remote_file_system_proxy.h"
19 20
20 using ::testing::_; 21 using ::testing::_;
21 using content::BrowserContext; 22 using content::BrowserContext;
22 23
23 // These should match the counterparts in remote.js. 24 // These should match the counterparts in remote.js.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 "Got unexpected error: File handler error: SECURITY_ERR"; 112 "Got unexpected error: File handler error: SECURITY_ERR";
112 } 113 }
113 114
114 class FileSystemExtensionApiTest : public ExtensionApiTest { 115 class FileSystemExtensionApiTest : public ExtensionApiTest {
115 public: 116 public:
116 FileSystemExtensionApiTest() : test_mount_point_("/tmp") { 117 FileSystemExtensionApiTest() : test_mount_point_("/tmp") {
117 } 118 }
118 119
119 virtual ~FileSystemExtensionApiTest() {} 120 virtual ~FileSystemExtensionApiTest() {}
120 121
122 void SetUpCommandLine(CommandLine* command_line) {
tbarzic 2012/04/13 02:58:30 I messed up indent here..
123 ExtensionApiTest::SetUpCommandLine(command_line);
124 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis);
125 }
126
121 // Adds a local mount point at at mount point /tmp. 127 // Adds a local mount point at at mount point /tmp.
122 void AddTmpMountPoint() { 128 void AddTmpMountPoint() {
123 fileapi::ExternalFileSystemMountPointProvider* provider = 129 fileapi::ExternalFileSystemMountPointProvider* provider =
124 BrowserContext::GetFileSystemContext(browser()->profile())-> 130 BrowserContext::GetFileSystemContext(browser()->profile())->
125 external_provider(); 131 external_provider();
126 provider->AddLocalMountPoint(test_mount_point_); 132 provider->AddLocalMountPoint(test_mount_point_);
127 } 133 }
128 134
129 private: 135 private:
130 FilePath test_mount_point_; 136 FilePath test_mount_point_;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 ASSERT_TRUE(RunComponentExtensionTest("local_filesystem")) << message_; 190 ASSERT_TRUE(RunComponentExtensionTest("local_filesystem")) << message_;
185 } 191 }
186 192
187 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserTest) { 193 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserTest) {
188 AddTmpMountPoint(); 194 AddTmpMountPoint();
189 ASSERT_TRUE(RunExtensionTest("filesystem_handler")) << message_; 195 ASSERT_TRUE(RunExtensionTest("filesystem_handler")) << message_;
190 ASSERT_TRUE(RunExtensionSubtest( 196 ASSERT_TRUE(RunExtensionSubtest(
191 "filebrowser_component", "read.html", kComponentFlags)) << message_; 197 "filebrowser_component", "read.html", kComponentFlags)) << message_;
192 } 198 }
193 199
200 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserTestLazy) {
201 AddTmpMountPoint();
202 ASSERT_TRUE(RunExtensionTest("filesystem_handler_lazy_background"))
203 << message_;
204 ASSERT_TRUE(RunExtensionSubtest(
205 "filebrowser_component", "read.html", kComponentFlags)) << message_;
206 }
207
194 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserTestWrite) { 208 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserTestWrite) {
195 AddTmpMountPoint(); 209 AddTmpMountPoint();
196 ASSERT_TRUE(RunExtensionTest("filesystem_handler_write")) << message_; 210 ASSERT_TRUE(RunExtensionTest("filesystem_handler_write")) << message_;
197 ASSERT_TRUE(RunExtensionSubtest( 211 ASSERT_TRUE(RunExtensionSubtest(
198 "filebrowser_component", "write.html", kComponentFlags)) << message_; 212 "filebrowser_component", "write.html", kComponentFlags)) << message_;
199 } 213 }
200 214
201 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, 215 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest,
202 FileBrowserTestWriteReadOnly) { 216 FileBrowserTestWriteReadOnly) {
203 AddTmpMountPoint(); 217 AddTmpMountPoint();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 .WillOnce(MockCreateSnapshotFile( 254 .WillOnce(MockCreateSnapshotFile(
241 base::PLATFORM_FILE_OK, 255 base::PLATFORM_FILE_OK,
242 test_file_info_, 256 test_file_info_,
243 // Returns the path to the temporary file on the local drive. 257 // Returns the path to the temporary file on the local drive.
244 test_file_path_, 258 test_file_path_,
245 scoped_refptr<webkit_blob::ShareableFileReference>(NULL))); 259 scoped_refptr<webkit_blob::ShareableFileReference>(NULL)));
246 ASSERT_TRUE(RunExtensionSubtest( 260 ASSERT_TRUE(RunExtensionSubtest(
247 "filebrowser_component", "remote.html#" + GetPathOnMountPoint(""), 261 "filebrowser_component", "remote.html#" + GetPathOnMountPoint(""),
248 kComponentFlags)) << message_; 262 kComponentFlags)) << message_;
249 } 263 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698