OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_manager/file_manager_browsertest_base.h" | 5 #include "chrome/browser/chromeos/file_manager/file_manager_browsertest_base.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 | 10 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 "entries", &AddEntriesMessage::entries); | 177 "entries", &AddEntriesMessage::entries); |
178 } | 178 } |
179 | 179 |
180 // Test volume. | 180 // Test volume. |
181 class TestVolume { | 181 class TestVolume { |
182 protected: | 182 protected: |
183 explicit TestVolume(const std::string& name) : name_(name) {} | 183 explicit TestVolume(const std::string& name) : name_(name) {} |
184 virtual ~TestVolume() {} | 184 virtual ~TestVolume() {} |
185 | 185 |
186 bool CreateRootDirectory(const Profile* profile) { | 186 bool CreateRootDirectory(const Profile* profile) { |
187 const base::FilePath path = profile->GetPath().Append(name_); | 187 if (root_initialized_) |
188 return root_.path() == path || root_.Set(path); | 188 return true; |
| 189 |
| 190 root_initialized_ = root_.Set(profile->GetPath().Append(name_)); |
| 191 return root_initialized_; |
189 } | 192 } |
190 | 193 |
191 const std::string& name() { return name_; } | 194 const std::string& name() const { return name_; } |
192 const base::FilePath root_path() { return root_.path(); } | 195 const base::FilePath& root_path() const { return root_.GetPath(); } |
193 | 196 |
194 private: | 197 private: |
195 std::string name_; | 198 std::string name_; |
196 base::ScopedTempDir root_; | 199 base::ScopedTempDir root_; |
| 200 bool root_initialized_ = false; |
197 }; | 201 }; |
198 | 202 |
199 // Listener to obtain the test relative messages synchronously. | 203 // Listener to obtain the test relative messages synchronously. |
200 class FileManagerTestListener : public content::NotificationObserver { | 204 class FileManagerTestListener : public content::NotificationObserver { |
201 public: | 205 public: |
202 struct Message { | 206 struct Message { |
203 int type; | 207 int type; |
204 std::string message; | 208 std::string message; |
205 scoped_refptr<extensions::TestSendMessageFunction> function; | 209 scoped_refptr<extensions::TestSendMessageFunction> function; |
206 }; | 210 }; |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 } | 735 } |
732 | 736 |
733 drive::DriveIntegrationService* | 737 drive::DriveIntegrationService* |
734 FileManagerBrowserTestBase::CreateDriveIntegrationService(Profile* profile) { | 738 FileManagerBrowserTestBase::CreateDriveIntegrationService(Profile* profile) { |
735 drive_volumes_[profile->GetOriginalProfile()].reset(new DriveTestVolume()); | 739 drive_volumes_[profile->GetOriginalProfile()].reset(new DriveTestVolume()); |
736 return drive_volumes_[profile->GetOriginalProfile()] | 740 return drive_volumes_[profile->GetOriginalProfile()] |
737 ->CreateDriveIntegrationService(profile); | 741 ->CreateDriveIntegrationService(profile); |
738 } | 742 } |
739 | 743 |
740 } // namespace file_manager | 744 } // namespace file_manager |
OLD | NEW |