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

Side by Side Diff: chrome/browser/chromeos/extensions/external_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: feedback + test failures 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/app/app_api.cc » ('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 "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"
(...skipping 12 matching lines...) Expand all
23 // These should match the counterparts in remote.js. 23 // These should match the counterparts in remote.js.
24 const char kTestDirPath[] = "/test_dir"; 24 const char kTestDirPath[] = "/test_dir";
25 const char kTestFilePath[] = "/test_dir/hello.txt"; 25 const char kTestFilePath[] = "/test_dir/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 int 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 }; 180 };
177 181
178 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, LocalFileSystem) { 182 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, LocalFileSystem) {
179 AddTmpMountPoint(); 183 AddTmpMountPoint();
180 ASSERT_TRUE(RunComponentExtensionTest("local_filesystem")) << message_; 184 ASSERT_TRUE(RunComponentExtensionTest("local_filesystem")) << message_;
181 } 185 }
182 186
183 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserTest) { 187 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserTest) {
184 AddTmpMountPoint(); 188 AddTmpMountPoint();
185 ASSERT_TRUE(RunExtensionTest("filesystem_handler")) << message_; 189 ASSERT_TRUE(RunExtensionTest("filesystem_handler")) << message_;
186 ASSERT_TRUE(RunComponentExtensionSubtest("filebrowser_component", 190 ASSERT_TRUE(RunExtensionSubtest(
187 "read.html")) << message_; 191 "filebrowser_component", "read.html", kComponentFlags)) << message_;
188 } 192 }
189 193
190 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserTestWrite) { 194 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserTestWrite) {
191 AddTmpMountPoint(); 195 AddTmpMountPoint();
192 ASSERT_TRUE(RunExtensionTest("filesystem_handler_write")) << message_; 196 ASSERT_TRUE(RunExtensionTest("filesystem_handler_write")) << message_;
193 ASSERT_TRUE(RunComponentExtensionSubtest("filebrowser_component", 197 ASSERT_TRUE(RunExtensionSubtest(
194 "write.html")) << message_; 198 "filebrowser_component", "write.html", kComponentFlags)) << message_;
195 } 199 }
196 200
197 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, 201 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest,
198 FileBrowserTestWriteComponent) { 202 FileBrowserTestWriteComponent) {
199 AddTmpMountPoint(); 203 AddTmpMountPoint();
200 ASSERT_TRUE(RunComponentExtensionTest("filesystem_handler_write")) 204 ASSERT_TRUE(RunComponentExtensionTest("filesystem_handler_write"))
201 << message_; 205 << message_;
202 ASSERT_TRUE(RunComponentExtensionSubtest("filebrowser_component", 206 ASSERT_TRUE(RunExtensionSubtest(
203 "write.html")) << message_; 207 "filebrowser_component", "write.html", kComponentFlags)) << message_;
204 } 208 }
205 209
206 IN_PROC_BROWSER_TEST_F(RemoteFileSystemExtensionApiTest, RemoteMountPoint) { 210 IN_PROC_BROWSER_TEST_F(RemoteFileSystemExtensionApiTest, RemoteMountPoint) {
207 AddTmpMountPoint(); 211 AddTmpMountPoint();
208 // The test directory is created first. 212 // The test directory is created first.
209 const GURL test_dir_url = 213 const GURL test_dir_url =
210 GetExpectedURL(GetPathOnMountPoint(kTestDirPath)); 214 GetExpectedURL(GetPathOnMountPoint(kTestDirPath));
211 EXPECT_CALL(*mock_remote_file_system_proxy_, 215 EXPECT_CALL(*mock_remote_file_system_proxy_,
212 CreateDirectory(test_dir_url, false, false, _)) 216 CreateDirectory(test_dir_url, false, false, _))
213 .WillOnce(MockCreateDirectory(base::PLATFORM_FILE_OK)); 217 .WillOnce(MockCreateDirectory(base::PLATFORM_FILE_OK));
(...skipping 10 matching lines...) Expand all
224 228
225 // Then CreateSnapshotFile() is called over "tmp/test_dir/hello.txt". 229 // Then CreateSnapshotFile() is called over "tmp/test_dir/hello.txt".
226 EXPECT_CALL(*mock_remote_file_system_proxy_, 230 EXPECT_CALL(*mock_remote_file_system_proxy_,
227 CreateSnapshotFile(expected_url, _)) 231 CreateSnapshotFile(expected_url, _))
228 .WillOnce(MockCreateSnapshotFile( 232 .WillOnce(MockCreateSnapshotFile(
229 base::PLATFORM_FILE_OK, 233 base::PLATFORM_FILE_OK,
230 test_file_info_, 234 test_file_info_,
231 // Returns the path to the temporary file on the local drive. 235 // Returns the path to the temporary file on the local drive.
232 test_file_path_, 236 test_file_path_,
233 scoped_refptr<webkit_blob::ShareableFileReference>(NULL))); 237 scoped_refptr<webkit_blob::ShareableFileReference>(NULL)));
234 ASSERT_TRUE(RunComponentExtensionSubtest( 238 ASSERT_TRUE(RunExtensionSubtest(
235 "filebrowser_component", 239 "filebrowser_component", "remote.html#" + GetPathOnMountPoint(""),
236 "remote.html#" + GetPathOnMountPoint(""))) << message_; 240 kComponentFlags)) << message_;
237 } 241 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/app/app_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698