| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 namespace testing { | 59 namespace testing { |
| 60 | 60 |
| 61 class ProfileManager : public ::ProfileManagerWithoutInit { | 61 class ProfileManager : public ::ProfileManagerWithoutInit { |
| 62 public: | 62 public: |
| 63 explicit ProfileManager(const base::FilePath& user_data_dir) | 63 explicit ProfileManager(const base::FilePath& user_data_dir) |
| 64 : ::ProfileManagerWithoutInit(user_data_dir) {} | 64 : ::ProfileManagerWithoutInit(user_data_dir) {} |
| 65 | 65 |
| 66 protected: | 66 protected: |
| 67 virtual Profile* CreateProfileHelper( | 67 virtual Profile* CreateProfileHelper( |
| 68 const base::FilePath& file_path) OVERRIDE { | 68 const base::FilePath& file_path) OVERRIDE { |
| 69 if (!file_util::PathExists(file_path)) { | 69 if (!base::PathExists(file_path)) { |
| 70 if (!file_util::CreateDirectory(file_path)) | 70 if (!file_util::CreateDirectory(file_path)) |
| 71 return NULL; | 71 return NULL; |
| 72 } | 72 } |
| 73 return new TestingProfile(file_path, NULL); | 73 return new TestingProfile(file_path, NULL); |
| 74 } | 74 } |
| 75 | 75 |
| 76 virtual Profile* CreateProfileAsyncHelper(const base::FilePath& path, | 76 virtual Profile* CreateProfileAsyncHelper(const base::FilePath& path, |
| 77 Delegate* delegate) OVERRIDE { | 77 Delegate* delegate) OVERRIDE { |
| 78 // This is safe while all file operations are done on the FILE thread. | 78 // This is safe while all file operations are done on the FILE thread. |
| 79 BrowserThread::PostTask( | 79 BrowserThread::PostTask( |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 dest_path2.BaseName().MaybeAsASCII()); | 762 dest_path2.BaseName().MaybeAsASCII()); |
| 763 profile_manager->ScheduleProfileForDeletion(dest_path2, | 763 profile_manager->ScheduleProfileForDeletion(dest_path2, |
| 764 ProfileManager::CreateCallback()); | 764 ProfileManager::CreateCallback()); |
| 765 // Spin the message loop so that all the callbacks can finish running. | 765 // Spin the message loop so that all the callbacks can finish running. |
| 766 message_loop_.RunUntilIdle(); | 766 message_loop_.RunUntilIdle(); |
| 767 | 767 |
| 768 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); | 768 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); |
| 769 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); | 769 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); |
| 770 } | 770 } |
| 771 #endif // !defined(OS_MACOSX) | 771 #endif // !defined(OS_MACOSX) |
| OLD | NEW |