OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/file_system_provider/mount_path_util.h" | 5 #include "chrome/browser/chromeos/file_system_provider/mount_path_util.h" |
6 | 6 |
| 7 #include <memory> |
7 #include <string> | 8 #include <string> |
8 | 9 |
9 #include "base/files/file.h" | 10 #include "base/files/file.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "chrome/browser/chromeos/file_system_provider/fake_provided_file_system
.h" | 11 #include "chrome/browser/chromeos/file_system_provider/fake_provided_file_system
.h" |
12 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte
rface.h" | 12 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte
rface.h" |
13 #include "chrome/browser/chromeos/file_system_provider/service.h" | 13 #include "chrome/browser/chromeos/file_system_provider/service.h" |
14 #include "chrome/browser/chromeos/file_system_provider/service_factory.h" | 14 #include "chrome/browser/chromeos/file_system_provider/service_factory.h" |
15 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" | 15 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
16 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 16 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_sy
stem_provider_capabilities_handler.h" | 18 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_sy
stem_provider_capabilities_handler.h" |
19 #include "chrome/test/base/testing_browser_process.h" | 19 #include "chrome/test/base/testing_browser_process.h" |
20 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 user_manager_ = new FakeChromeUserManager(); | 71 user_manager_ = new FakeChromeUserManager(); |
72 user_manager_enabler_.reset(new ScopedUserManagerEnabler(user_manager_)); | 72 user_manager_enabler_.reset(new ScopedUserManagerEnabler(user_manager_)); |
73 user_manager_->AddUser( | 73 user_manager_->AddUser( |
74 AccountId::FromUserEmail(profile_->GetProfileUserName())); | 74 AccountId::FromUserEmail(profile_->GetProfileUserName())); |
75 file_system_provider_service_ = Service::Get(profile_); | 75 file_system_provider_service_ = Service::Get(profile_); |
76 file_system_provider_service_->SetFileSystemFactoryForTesting( | 76 file_system_provider_service_->SetFileSystemFactoryForTesting( |
77 base::Bind(&FakeProvidedFileSystem::Create)); | 77 base::Bind(&FakeProvidedFileSystem::Create)); |
78 } | 78 } |
79 | 79 |
80 content::TestBrowserThreadBundle thread_bundle_; | 80 content::TestBrowserThreadBundle thread_bundle_; |
81 scoped_ptr<TestingProfileManager> profile_manager_; | 81 std::unique_ptr<TestingProfileManager> profile_manager_; |
82 TestingProfile* profile_; // Owned by TestingProfileManager. | 82 TestingProfile* profile_; // Owned by TestingProfileManager. |
83 scoped_ptr<ScopedUserManagerEnabler> user_manager_enabler_; | 83 std::unique_ptr<ScopedUserManagerEnabler> user_manager_enabler_; |
84 FakeChromeUserManager* user_manager_; | 84 FakeChromeUserManager* user_manager_; |
85 Service* file_system_provider_service_; // Owned by its factory. | 85 Service* file_system_provider_service_; // Owned by its factory. |
86 }; | 86 }; |
87 | 87 |
88 TEST_F(FileSystemProviderMountPathUtilTest, GetMountPath) { | 88 TEST_F(FileSystemProviderMountPathUtilTest, GetMountPath) { |
89 const base::FilePath result = | 89 const base::FilePath result = |
90 GetMountPath(profile_, kExtensionId, kFileSystemId); | 90 GetMountPath(profile_, kExtensionId, kFileSystemId); |
91 const std::string expected = | 91 const std::string expected = |
92 "/provided/mbflcebpggnecokmikipoihdbecnjfoj:" | 92 "/provided/mbflcebpggnecokmikipoihdbecnjfoj:" |
93 "File%2FSystem%2FId:testing-profile-hash"; | 93 "File%2FSystem%2FId:testing-profile-hash"; |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 const base::FilePath kFilePath = | 293 const base::FilePath kFilePath = |
294 base::FilePath(FILE_PATH_LITERAL("provided/hello/world")); | 294 base::FilePath(FILE_PATH_LITERAL("provided/hello/world")); |
295 LocalPathParser parser(profile_, kFilePath); | 295 LocalPathParser parser(profile_, kFilePath); |
296 EXPECT_FALSE(parser.Parse()); | 296 EXPECT_FALSE(parser.Parse()); |
297 } | 297 } |
298 } | 298 } |
299 | 299 |
300 } // namespace util | 300 } // namespace util |
301 } // namespace file_system_provider | 301 } // namespace file_system_provider |
302 } // namespace chromeos | 302 } // namespace chromeos |
OLD | NEW |