OLD | NEW |
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" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 virtual ~RemoteFileSystemExtensionApiTest() {} | 246 virtual ~RemoteFileSystemExtensionApiTest() {} |
247 | 247 |
248 virtual void SetUp() OVERRIDE { | 248 virtual void SetUp() OVERRIDE { |
249 // Set up cache root and documents service to be used when creating gdata | 249 // Set up cache root and documents service to be used when creating gdata |
250 // system service. This has to be done early on (before the browser is | 250 // system service. This has to be done early on (before the browser is |
251 // created) because the system service instance is initialized very early | 251 // created) because the system service instance is initialized very early |
252 // by FileBrowserEventRouter. | 252 // by FileBrowserEventRouter. |
253 FilePath tmp_dir_path; | 253 FilePath tmp_dir_path; |
254 PathService::Get(base::DIR_TEMP, &tmp_dir_path); | 254 PathService::Get(base::DIR_TEMP, &tmp_dir_path); |
255 ASSERT_TRUE(test_cache_root_.CreateUniqueTempDirUnderPath(tmp_dir_path)); | 255 ASSERT_TRUE(test_cache_root_.CreateUniqueTempDirUnderPath(tmp_dir_path)); |
256 gdata::DriveSystemServiceFactory::set_cache_root_for_test( | 256 drive::DriveSystemServiceFactory::set_cache_root_for_test( |
257 test_cache_root_.path().value()); | 257 test_cache_root_.path().value()); |
258 | 258 |
259 mock_drive_service_ = new gdata::MockDriveService(); | 259 mock_drive_service_ = new drive::MockDriveService(); |
260 | 260 |
261 // |mock_drive_service_| will eventually get owned by a system service. | 261 // |mock_drive_service_| will eventually get owned by a system service. |
262 gdata::DriveSystemServiceFactory::set_drive_service_for_test( | 262 drive::DriveSystemServiceFactory::set_drive_service_for_test( |
263 mock_drive_service_); | 263 mock_drive_service_); |
264 | 264 |
265 ExtensionApiTest::SetUp(); | 265 ExtensionApiTest::SetUp(); |
266 } | 266 } |
267 | 267 |
268 virtual void TearDown() OVERRIDE { | 268 virtual void TearDown() OVERRIDE { |
269 // Let's make sure we don't leak documents service. | 269 // Let's make sure we don't leak documents service. |
270 gdata::DriveSystemServiceFactory::set_drive_service_for_test(NULL); | 270 drive::DriveSystemServiceFactory::set_drive_service_for_test(NULL); |
271 gdata::DriveSystemServiceFactory::set_cache_root_for_test(std::string()); | 271 drive::DriveSystemServiceFactory::set_cache_root_for_test(std::string()); |
272 ExtensionApiTest::TearDown(); | 272 ExtensionApiTest::TearDown(); |
273 } | 273 } |
274 | 274 |
275 protected: | 275 protected: |
276 ScopedTempDir test_cache_root_; | 276 ScopedTempDir test_cache_root_; |
277 gdata::MockDriveService* mock_drive_service_; | 277 drive::MockDriveService* mock_drive_service_; |
278 }; | 278 }; |
279 | 279 |
280 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, LocalFileSystem) { | 280 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, LocalFileSystem) { |
281 AddTmpMountPoint(); | 281 AddTmpMountPoint(); |
282 ASSERT_TRUE(RunComponentExtensionTest("local_filesystem")) << message_; | 282 ASSERT_TRUE(RunComponentExtensionTest("local_filesystem")) << message_; |
283 } | 283 } |
284 | 284 |
285 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserTest) { | 285 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserTest) { |
286 AddTmpMountPoint(); | 286 AddTmpMountPoint(); |
287 ASSERT_TRUE(RunExtensionTest("filesystem_handler")) << message_; | 287 ASSERT_TRUE(RunExtensionTest("filesystem_handler")) << message_; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 _, _)) | 436 _, _)) |
437 .WillOnce(MockDownloadFileCallback(gdata::HTTP_SUCCESS)); | 437 .WillOnce(MockDownloadFileCallback(gdata::HTTP_SUCCESS)); |
438 | 438 |
439 // On exit, all operations in progress should be cancelled. | 439 // On exit, all operations in progress should be cancelled. |
440 EXPECT_CALL(*mock_drive_service_, CancelAll()); | 440 EXPECT_CALL(*mock_drive_service_, CancelAll()); |
441 | 441 |
442 // All is set... RUN THE TEST. | 442 // All is set... RUN THE TEST. |
443 EXPECT_TRUE(RunExtensionSubtest("filebrowser_component", "remote_search.html", | 443 EXPECT_TRUE(RunExtensionSubtest("filebrowser_component", "remote_search.html", |
444 kComponentFlags)) << message_; | 444 kComponentFlags)) << message_; |
445 } | 445 } |
OLD | NEW |