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

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

Issue 10909182: Make FileSystemContext respect StoragePartitions. filesystem:// urls will be properly isolated (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch unittest fix from michael Created 8 years, 3 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/bind.h" 5 #include "base/bind.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/json/json_file_value_serializer.h" 8 #include "base/json/json_file_value_serializer.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/scoped_temp_dir.h" 12 #include "base/scoped_temp_dir.h"
13 #include "base/threading/worker_pool.h" 13 #include "base/threading/worker_pool.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/browser/chromeos/gdata/drive_file_system.h" 15 #include "chrome/browser/chromeos/gdata/drive_file_system.h"
16 #include "chrome/browser/chromeos/gdata/drive_system_service.h" 16 #include "chrome/browser/chromeos/gdata/drive_system_service.h"
17 #include "chrome/browser/chromeos/gdata/gdata_util.h" 17 #include "chrome/browser/chromeos/gdata/gdata_util.h"
18 #include "chrome/browser/chromeos/gdata/gdata_wapi_parser.h" 18 #include "chrome/browser/chromeos/gdata/gdata_wapi_parser.h"
19 #include "chrome/browser/chromeos/gdata/mock_drive_service.h" 19 #include "chrome/browser/chromeos/gdata/mock_drive_service.h"
20 #include "chrome/browser/extensions/extension_apitest.h" 20 #include "chrome/browser/extensions/extension_apitest.h"
21 #include "chrome/browser/extensions/extension_test_message_listener.h" 21 #include "chrome/browser/extensions/extension_test_message_listener.h"
22 #include "chrome/browser/google_apis/operation_registry.h" 22 #include "chrome/browser/google_apis/operation_registry.h"
23 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/ui/browser.h" 24 #include "chrome/browser/ui/browser.h"
25 #include "chrome/common/chrome_notification_types.h" 25 #include "chrome/common/chrome_notification_types.h"
26 #include "chrome/common/chrome_paths.h" 26 #include "chrome/common/chrome_paths.h"
27 #include "chrome/common/chrome_switches.h" 27 #include "chrome/common/chrome_switches.h"
28 #include "content/public/browser/browser_context.h"
28 #include "content/public/browser/browser_thread.h" 29 #include "content/public/browser/browser_thread.h"
29 #include "content/public/browser/notification_service.h" 30 #include "content/public/browser/notification_service.h"
31 #include "content/public/browser/storage_partition.h"
30 #include "content/public/test/test_utils.h" 32 #include "content/public/test/test_utils.h"
31 #include "testing/gmock/include/gmock/gmock.h" 33 #include "testing/gmock/include/gmock/gmock.h"
32 #include "webkit/fileapi/file_system_context.h" 34 #include "webkit/fileapi/file_system_context.h"
33 #include "webkit/fileapi/file_system_mount_point_provider.h" 35 #include "webkit/fileapi/file_system_mount_point_provider.h"
34 36
35 using ::testing::_; 37 using ::testing::_;
36 using ::testing::Return; 38 using ::testing::Return;
37 using content::BrowserContext; 39 using content::BrowserContext;
38 40
39 namespace { 41 namespace {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 virtual ~FileSystemExtensionApiTest() {} 160 virtual ~FileSystemExtensionApiTest() {}
159 161
160 void SetUpCommandLine(CommandLine* command_line) { 162 void SetUpCommandLine(CommandLine* command_line) {
161 ExtensionApiTest::SetUpCommandLine(command_line); 163 ExtensionApiTest::SetUpCommandLine(command_line);
162 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); 164 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis);
163 } 165 }
164 166
165 // Adds a local mount point at at mount point /tmp. 167 // Adds a local mount point at at mount point /tmp.
166 void AddTmpMountPoint() { 168 void AddTmpMountPoint() {
167 fileapi::ExternalFileSystemMountPointProvider* provider = 169 fileapi::ExternalFileSystemMountPointProvider* provider =
168 BrowserContext::GetFileSystemContext(browser()->profile())-> 170 BrowserContext::GetDefaultStoragePartition(
169 external_provider(); 171 browser()->profile())->GetFileSystemContext()->external_provider();
170 provider->AddLocalMountPoint(test_mount_point_); 172 provider->AddLocalMountPoint(test_mount_point_);
171 } 173 }
172 174
173 // Loads the extension, which temporarily starts the lazy background page 175 // Loads the extension, which temporarily starts the lazy background page
174 // to dispatch the onInstalled event. We wait until it shuts down again. 176 // to dispatch the onInstalled event. We wait until it shuts down again.
175 const extensions::Extension* LoadExtensionAndWait( 177 const extensions::Extension* LoadExtensionAndWait(
176 const std::string& test_name) { 178 const std::string& test_name) {
177 BackgroundObserver page_complete; 179 BackgroundObserver page_complete;
178 FilePath extdir = test_data_dir_.AppendASCII(test_name); 180 FilePath extdir = test_data_dir_.AppendASCII(test_name);
179 const extensions::Extension* extension = LoadExtension(extdir); 181 const extensions::Extension* extension = LoadExtension(extdir);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 _, _)) 357 _, _))
356 .WillOnce(MockDownloadFileCallback(gdata::HTTP_SUCCESS)); 358 .WillOnce(MockDownloadFileCallback(gdata::HTTP_SUCCESS));
357 359
358 // On exit, all operations in progress should be cancelled. 360 // On exit, all operations in progress should be cancelled.
359 EXPECT_CALL(*mock_drive_service_, CancelAll()); 361 EXPECT_CALL(*mock_drive_service_, CancelAll());
360 362
361 // All is set... RUN THE TEST. 363 // All is set... RUN THE TEST.
362 EXPECT_TRUE(RunExtensionSubtest("filebrowser_component", "remote_search.html", 364 EXPECT_TRUE(RunExtensionSubtest("filebrowser_component", "remote_search.html",
363 kComponentFlags)) << message_; 365 kComponentFlags)) << message_;
364 } 366 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698