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

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

Issue 271533004: Turning on MultiProfile by default for ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 "base/path_service.h"
9 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chrome_notification_types.h" 11 #include "chrome/browser/chrome_notification_types.h"
11 #include "chrome/browser/chromeos/drive/drive_integration_service.h" 12 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
12 #include "chrome/browser/chromeos/drive/test_util.h" 13 #include "chrome/browser/chromeos/drive/test_util.h"
13 #include "chrome/browser/chromeos/file_manager/drive_test_util.h" 14 #include "chrome/browser/chromeos/file_manager/drive_test_util.h"
14 #include "chrome/browser/chromeos/file_manager/volume_manager.h" 15 #include "chrome/browser/chromeos/file_manager/volume_manager.h"
16 #include "chrome/browser/chromeos/login/user_manager.h"
17 #include "chrome/browser/chromeos/profiles/profile_helper.h"
15 #include "chrome/browser/drive/fake_drive_service.h" 18 #include "chrome/browser/drive/fake_drive_service.h"
16 #include "chrome/browser/extensions/extension_apitest.h" 19 #include "chrome/browser/extensions/extension_apitest.h"
17 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/profiles/profile_manager.h" 21 #include "chrome/browser/profiles/profile_manager.h"
19 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
20 #include "chrome/common/chrome_constants.h" 23 #include "chrome/common/chrome_constants.h"
24 #include "chrome/common/chrome_paths.h"
21 #include "content/public/browser/browser_context.h" 25 #include "content/public/browser/browser_context.h"
22 #include "content/public/browser/notification_service.h" 26 #include "content/public/browser/notification_service.h"
23 #include "content/public/test/test_utils.h" 27 #include "content/public/test/test_utils.h"
24 #include "google_apis/drive/test_util.h" 28 #include "google_apis/drive/test_util.h"
25 #include "google_apis/drive/time_util.h" 29 #include "google_apis/drive/time_util.h"
26 #include "webkit/browser/fileapi/external_mount_points.h" 30 #include "webkit/browser/fileapi/external_mount_points.h"
27 31
28 // Tests for access to external file systems (as defined in 32 // Tests for access to external file systems (as defined in
29 // webkit/common/fileapi/file_system_types.h) from extensions with 33 // webkit/common/fileapi/file_system_types.h) from extensions with
30 // fileBrowserPrivate and fileBrowserHandler extension permissions. 34 // fileBrowserPrivate and fileBrowserHandler extension permissions.
(...skipping 27 matching lines...) Expand all
58 // Root dirs for file systems expected by the test extensions. 62 // Root dirs for file systems expected by the test extensions.
59 // NOTE: Root dir for drive file system is set by Chrome's drive implementation, 63 // NOTE: Root dir for drive file system is set by Chrome's drive implementation,
60 // but the test will have to make sure the mount point is added before 64 // but the test will have to make sure the mount point is added before
61 // starting a test extension using WaitUntilDriveMountPointIsAdded(). 65 // starting a test extension using WaitUntilDriveMountPointIsAdded().
62 const char kLocalMountPointName[] = "local"; 66 const char kLocalMountPointName[] = "local";
63 const char kRestrictedMountPointName[] = "restricted"; 67 const char kRestrictedMountPointName[] = "restricted";
64 68
65 // Default file content for the test files. 69 // Default file content for the test files.
66 const char kTestFileContent[] = "This is some test content."; 70 const char kTestFileContent[] = "This is some test content.";
67 71
72 // User account email and directory hash for secondary account for multi-profile
73 // sensitive test cases.
74 const char kSecondProfileAccount[] = "profile2@test.com";
75 const char kSecondProfileHash[] = "fileBrowserApiTestProfile2";
76
68 // Sets up the initial file system state for native local and restricted native 77 // Sets up the initial file system state for native local and restricted native
69 // local file systems. The hierarchy is the same as for the drive file system. 78 // local file systems. The hierarchy is the same as for the drive file system.
70 // The directory is created at unique_temp_dir/|mount_point_name| path. 79 // The directory is created at unique_temp_dir/|mount_point_name| path.
71 bool InitializeLocalFileSystem(std::string mount_point_name, 80 bool InitializeLocalFileSystem(std::string mount_point_name,
72 base::ScopedTempDir* tmp_dir, 81 base::ScopedTempDir* tmp_dir,
73 base::FilePath* mount_point_dir) { 82 base::FilePath* mount_point_dir) {
74 if (!tmp_dir->CreateUniqueTempDir()) 83 if (!tmp_dir->CreateUniqueTempDir())
75 return false; 84 return false;
76 85
77 *mount_point_dir = tmp_dir->path().AppendASCII(mount_point_name); 86 *mount_point_dir = tmp_dir->path().AppendASCII(mount_point_name);
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 service_factory_for_test_; 503 service_factory_for_test_;
495 }; 504 };
496 505
497 // Tests for Drive file systems in multi-profile setting. 506 // Tests for Drive file systems in multi-profile setting.
498 class MultiProfileDriveFileSystemExtensionApiTest : 507 class MultiProfileDriveFileSystemExtensionApiTest :
499 public FileSystemExtensionApiTestBase { 508 public FileSystemExtensionApiTestBase {
500 public: 509 public:
501 MultiProfileDriveFileSystemExtensionApiTest() : second_profile(NULL) {} 510 MultiProfileDriveFileSystemExtensionApiTest() : second_profile(NULL) {}
502 511
503 virtual void SetUpOnMainThread() OVERRIDE { 512 virtual void SetUpOnMainThread() OVERRIDE {
513 base::FilePath user_data_directory;
514 PathService::Get(chrome::DIR_USER_DATA, &user_data_directory);
515 chromeos::UserManager::Get()->UserLoggedIn(kSecondProfileAccount,
516 kSecondProfileHash,
517 false);
504 // Set up the secondary profile. 518 // Set up the secondary profile.
505 base::FilePath profile_dir; 519 base::FilePath profile_dir =
506 base::CreateNewTempDirectory(base::FilePath::StringType(), &profile_dir); 520 user_data_directory.Append(
507 profile_dir = profile_dir.AppendASCII( 521 chromeos::ProfileHelper::GetUserProfileDir(
508 std::string(chrome::kProfileDirPrefix) + "fileBrowserApiTestProfile2"); 522 kSecondProfileHash).BaseName());
509 second_profile = 523 second_profile =
510 g_browser_process->profile_manager()->GetProfile(profile_dir); 524 g_browser_process->profile_manager()->GetProfile(profile_dir);
511 525
512 FileSystemExtensionApiTestBase::SetUpOnMainThread(); 526 FileSystemExtensionApiTestBase::SetUpOnMainThread();
513 } 527 }
514 528
515 virtual void InitTestFileSystem() OVERRIDE { 529 virtual void InitTestFileSystem() OVERRIDE {
516 // This callback will get called during Profile creation. 530 // This callback will get called during Profile creation.
517 create_drive_integration_service_ = base::Bind( 531 create_drive_integration_service_ = base::Bind(
518 &MultiProfileDriveFileSystemExtensionApiTest:: 532 &MultiProfileDriveFileSystemExtensionApiTest::
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 ASSERT_TRUE(AddTestHostedDocuments()); 707 ASSERT_TRUE(AddTestHostedDocuments());
694 EXPECT_TRUE(RunFileSystemExtensionApiTest( 708 EXPECT_TRUE(RunFileSystemExtensionApiTest(
695 "file_browser/multi_profile_copy", 709 "file_browser/multi_profile_copy",
696 FILE_PATH_LITERAL("manifest.json"), 710 FILE_PATH_LITERAL("manifest.json"),
697 "", 711 "",
698 FLAGS_NONE)) << message_; 712 FLAGS_NONE)) << message_;
699 } 713 }
700 714
701 } // namespace 715 } // namespace
702 } // namespace file_manager 716 } // namespace file_manager
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc ('k') | chrome/browser/chromeos/file_manager/path_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698