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

Side by Side Diff: chrome/browser/extensions/extension_local_filesystem_apitest.cc

Issue 9737001: Fix crash in AppNotifyChannelSetup when incognito profiles are used. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: forgot a file Created 8 years, 9 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/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 12 matching lines...) Expand all
23 23
24 // These should match the counterparts in remote.js. 24 // These should match the counterparts in remote.js.
25 const char kTestFileName[] = "hello.txt"; 25 const char kTestFileName[] = "hello.txt";
26 const char kTestFileContents[] = "hello, world"; 26 const char kTestFileContents[] = "hello, world";
27 27
28 namespace { 28 namespace {
29 29
30 // The ID of the file browser extension. 30 // The ID of the file browser extension.
31 const char kFileBrowserExtensionId[] = "ddammdhioacbehjngdmkjcjbnfginlla"; 31 const char kFileBrowserExtensionId[] = "ddammdhioacbehjngdmkjcjbnfginlla";
32 32
33 // Flags used to run the tests with a COMPONENT extension.
34 const char kComponentFlags = ExtensionApiTest::kFlagEnableFileAccess |
35 ExtensionApitest::kFlagLoadAsComponent;
36
33 // Returns the expected URL for the given path. 37 // Returns the expected URL for the given path.
34 GURL GetExpectedURL(const std::string& path) { 38 GURL GetExpectedURL(const std::string& path) {
35 return GURL( 39 return GURL(
36 base::StringPrintf( 40 base::StringPrintf(
37 "filesystem:chrome-extension://%s/external/%s", 41 "filesystem:chrome-extension://%s/external/%s",
38 kFileBrowserExtensionId, 42 kFileBrowserExtensionId,
39 path.c_str())); 43 path.c_str()));
40 } 44 }
41 45
42 // Action used to set mock expectations for CreateDirectory(). 46 // Action used to set mock expectations for CreateDirectory().
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 }; 177 };
174 178
175 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, LocalFileSystem) { 179 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, LocalFileSystem) {
176 AddTmpMountPoint(); 180 AddTmpMountPoint();
177 ASSERT_TRUE(RunComponentExtensionTest("local_filesystem")) << message_; 181 ASSERT_TRUE(RunComponentExtensionTest("local_filesystem")) << message_;
178 } 182 }
179 183
180 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserTest) { 184 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserTest) {
181 AddTmpMountPoint(); 185 AddTmpMountPoint();
182 ASSERT_TRUE(RunExtensionTest("filesystem_handler")) << message_; 186 ASSERT_TRUE(RunExtensionTest("filesystem_handler")) << message_;
183 ASSERT_TRUE(RunComponentExtensionSubtest("filebrowser_component", 187 ASSERT_TRUE(RunExtensionSubtest(
184 "read.html")) << message_; 188 "filebrowser_component", "read.html", kComponentFlags)) << message_;
185 } 189 }
186 190
187 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserTestWrite) { 191 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserTestWrite) {
188 AddTmpMountPoint(); 192 AddTmpMountPoint();
189 ASSERT_TRUE(RunExtensionTest("filesystem_handler_write")) << message_; 193 ASSERT_TRUE(RunExtensionTest("filesystem_handler_write")) << message_;
190 ASSERT_TRUE(RunComponentExtensionSubtest("filebrowser_component", 194 ASSERT_TRUE(RunExtensionSubtest(
191 "write.html")) << message_; 195 "filebrowser_component", "write.html", kComponentFlags)) << message_;
192 } 196 }
193 197
194 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, 198 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest,
195 FileBrowserTestWriteComponent) { 199 FileBrowserTestWriteComponent) {
196 AddTmpMountPoint(); 200 AddTmpMountPoint();
197 ASSERT_TRUE(RunComponentExtensionTest("filesystem_handler_write")) 201 ASSERT_TRUE(RunComponentExtensionTest("filesystem_handler_write"))
198 << message_; 202 << message_;
199 ASSERT_TRUE(RunComponentExtensionSubtest("filebrowser_component", 203 ASSERT_TRUE(RunExtensionSubtest(
200 "write.html")) << message_; 204 "filebrowser_component", "write.html", kComponentFlags)) << message_;
201 } 205 }
202 206
203 IN_PROC_BROWSER_TEST_F(RemoteFileSystemExtensionApiTest, RemoteMountPoint) { 207 IN_PROC_BROWSER_TEST_F(RemoteFileSystemExtensionApiTest, RemoteMountPoint) {
204 AddTmpMountPoint(); 208 AddTmpMountPoint();
205 209
206 // The test directory is created first. 210 // The test directory is created first.
207 const GURL test_dir_url = GetExpectedURL("tmp/test_dir"); 211 const GURL test_dir_url = GetExpectedURL("tmp/test_dir");
208 EXPECT_CALL(*mock_remote_file_system_proxy_, 212 EXPECT_CALL(*mock_remote_file_system_proxy_,
209 CreateDirectory(test_dir_url, false, false, _)) 213 CreateDirectory(test_dir_url, false, false, _))
210 .WillOnce(MockCreateDirectory(base::PLATFORM_FILE_OK)); 214 .WillOnce(MockCreateDirectory(base::PLATFORM_FILE_OK));
(...skipping 12 matching lines...) Expand all
223 // Then CreateSnapshotFile() is called over "tmp/test_dir/hello.txt". 227 // Then CreateSnapshotFile() is called over "tmp/test_dir/hello.txt".
224 EXPECT_CALL(*mock_remote_file_system_proxy_, 228 EXPECT_CALL(*mock_remote_file_system_proxy_,
225 CreateSnapshotFile(expected_url, _)) 229 CreateSnapshotFile(expected_url, _))
226 .WillOnce(MockCreateSnapshotFile( 230 .WillOnce(MockCreateSnapshotFile(
227 base::PLATFORM_FILE_OK, 231 base::PLATFORM_FILE_OK,
228 test_file_info_, 232 test_file_info_,
229 // Returns the path to the temporary file on the local drive. 233 // Returns the path to the temporary file on the local drive.
230 test_file_path_, 234 test_file_path_,
231 scoped_refptr<webkit_blob::ShareableFileReference>(NULL))); 235 scoped_refptr<webkit_blob::ShareableFileReference>(NULL)));
232 236
233 ASSERT_TRUE(RunComponentExtensionSubtest("filebrowser_component", 237 ASSERT_TRUE(RunExtensionSubtest(
234 "remote.html")) << message_; 238 "filebrowser_component", "remote.html", kComponentFlags)) << message_;
235 } 239 }
236 240
237 #endif 241 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698