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

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

Issue 118043003: Fix app_shell shutdown crash due to BrowserContextKeyedServices (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup (shutdown_crash) Created 6 years, 11 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_util.h" 6 #include "base/file_util.h"
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/chromeos/drive/drive_integration_service.h" 10 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 base::ScopedTempDir tmp_dir_; 284 base::ScopedTempDir tmp_dir_;
285 base::FilePath mount_point_dir_; 285 base::FilePath mount_point_dir_;
286 }; 286 };
287 287
288 // Tests for a drive file system. 288 // Tests for a drive file system.
289 class DriveFileSystemExtensionApiTest : public FileSystemExtensionApiTestBase { 289 class DriveFileSystemExtensionApiTest : public FileSystemExtensionApiTestBase {
290 public: 290 public:
291 DriveFileSystemExtensionApiTest() : fake_drive_service_(NULL) {} 291 DriveFileSystemExtensionApiTest() : fake_drive_service_(NULL) {}
292 virtual ~DriveFileSystemExtensionApiTest() {} 292 virtual ~DriveFileSystemExtensionApiTest() {}
293 293
294 virtual void TearDown() OVERRIDE {
295 FileSystemExtensionApiTestBase::TearDown();
296 drive::DriveIntegrationServiceFactory::SetFactoryForTest(NULL);
297 }
298
294 // FileSystemExtensionApiTestBase OVERRIDE. 299 // FileSystemExtensionApiTestBase OVERRIDE.
295 virtual void InitTestFileSystem() OVERRIDE { 300 virtual void InitTestFileSystem() OVERRIDE {
296 // Set up cache root to be used by DriveIntegrationService. This has to be 301 // Set up cache root to be used by DriveIntegrationService. This has to be
297 // done before the browser is created because the service instance is 302 // done before the browser is created because the service instance is
298 // initialized by EventRouter. 303 // initialized by EventRouter.
299 ASSERT_TRUE(test_cache_root_.CreateUniqueTempDir()); 304 ASSERT_TRUE(test_cache_root_.CreateUniqueTempDir());
300 305
306 create_drive_integration_service_ = base::Bind(
307 &DriveFileSystemExtensionApiTest::CreateDriveIntegrationService,
308 base::Unretained(this));
301 drive::DriveIntegrationServiceFactory::SetFactoryForTest( 309 drive::DriveIntegrationServiceFactory::SetFactoryForTest(
302 base::Bind( 310 &create_drive_integration_service_);
303 &DriveFileSystemExtensionApiTest::CreateDriveIntegrationService,
304 base::Unretained(this)));
305 } 311 }
306 312
307 // FileSystemExtensionApiTestBase OVERRIDE. 313 // FileSystemExtensionApiTestBase OVERRIDE.
308 virtual void AddTestMountPoint() OVERRIDE { 314 virtual void AddTestMountPoint() OVERRIDE {
309 test_util::WaitUntilDriveMountPointIsAdded(browser()->profile()); 315 test_util::WaitUntilDriveMountPointIsAdded(browser()->profile());
310 } 316 }
311 317
312 protected: 318 protected:
313 // DriveIntegrationService factory function for this test. 319 // DriveIntegrationService factory function for this test.
314 drive::DriveIntegrationService* CreateDriveIntegrationService( 320 drive::DriveIntegrationService* CreateDriveIntegrationService(
315 Profile* profile) { 321 Profile* profile) {
316 fake_drive_service_ = new drive::FakeDriveService; 322 fake_drive_service_ = new drive::FakeDriveService;
317 fake_drive_service_->LoadResourceListForWapi(kTestRootFeed); 323 fake_drive_service_->LoadResourceListForWapi(kTestRootFeed);
318 fake_drive_service_->LoadAccountMetadataForWapi( 324 fake_drive_service_->LoadAccountMetadataForWapi(
319 "gdata/account_metadata.json"); 325 "gdata/account_metadata.json");
320 fake_drive_service_->LoadAppListForDriveApi("drive/applist.json"); 326 fake_drive_service_->LoadAppListForDriveApi("drive/applist.json");
321 327
322 return new drive::DriveIntegrationService( 328 return new drive::DriveIntegrationService(
323 profile, NULL, 329 profile, NULL,
324 fake_drive_service_, test_cache_root_.path(), NULL); 330 fake_drive_service_, test_cache_root_.path(), NULL);
325 } 331 }
326 332
327 base::ScopedTempDir test_cache_root_; 333 base::ScopedTempDir test_cache_root_;
328 drive::FakeDriveService* fake_drive_service_; 334 drive::FakeDriveService* fake_drive_service_;
335 drive::DriveIntegrationServiceFactory::FactoryCallback
336 create_drive_integration_service_;
329 }; 337 };
330 338
331 // 339 //
332 // LocalFileSystemExtensionApiTests. 340 // LocalFileSystemExtensionApiTests.
333 // 341 //
334 342
335 IN_PROC_BROWSER_TEST_F(LocalFileSystemExtensionApiTest, FileSystemOperations) { 343 IN_PROC_BROWSER_TEST_F(LocalFileSystemExtensionApiTest, FileSystemOperations) {
336 EXPECT_TRUE(RunFileSystemExtensionApiTest( 344 EXPECT_TRUE(RunFileSystemExtensionApiTest(
337 "file_browser/filesystem_operations_test", 345 "file_browser/filesystem_operations_test",
338 FILE_PATH_LITERAL("manifest.json"), 346 FILE_PATH_LITERAL("manifest.json"),
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 fake_drive_service_->set_default_max_results(1); 435 fake_drive_service_->set_default_max_results(1);
428 EXPECT_TRUE(RunFileSystemExtensionApiTest( 436 EXPECT_TRUE(RunFileSystemExtensionApiTest(
429 "file_browser/handler_test_runner", 437 "file_browser/handler_test_runner",
430 FILE_PATH_LITERAL("manifest.json"), 438 FILE_PATH_LITERAL("manifest.json"),
431 "file_browser/app_file_handler", 439 "file_browser/app_file_handler",
432 FLAGS_USE_FILE_HANDLER)) << message_; 440 FLAGS_USE_FILE_HANDLER)) << message_;
433 } 441 }
434 442
435 } // namespace 443 } // namespace
436 } // namespace file_manager 444 } // namespace file_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698