Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / test / base / testing_profile_manager.cc
index cd3eb5d..dd41700 100644 (file)
@@ -34,7 +34,8 @@ class ProfileManager : public ::ProfileManagerWithoutInit {
 TestingProfileManager::TestingProfileManager(TestingBrowserProcess* process)
     : called_set_up_(false),
       browser_process_(process),
-      local_state_(process) {
+      local_state_(process),
+      profile_manager_(NULL) {
 }
 
 TestingProfileManager::~TestingProfileManager() {
@@ -53,7 +54,7 @@ TestingProfile* TestingProfileManager::CreateTestingProfile(
     scoped_ptr<PrefServiceSyncable> prefs,
     const base::string16& user_name,
     int avatar_id,
-    const std::string& managed_user_id,
+    const std::string& supervised_user_id,
     const TestingProfile::TestingFactories& factories) {
   DCHECK(called_set_up_);
 
@@ -65,7 +66,7 @@ TestingProfile* TestingProfileManager::CreateTestingProfile(
   TestingProfile::Builder builder;
   builder.SetPath(profile_path);
   builder.SetPrefService(prefs.Pass());
-  builder.SetManagedUserId(managed_user_id);
+  builder.SetSupervisedUserId(supervised_user_id);
 
   for (TestingProfile::TestingFactories::const_iterator it = factories.begin();
        it != factories.end(); ++it) {
@@ -80,7 +81,7 @@ TestingProfile* TestingProfileManager::CreateTestingProfile(
   ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache();
   size_t index = cache.GetIndexOfProfileWithPath(profile_path);
   cache.SetAvatarIconOfProfileAtIndex(index, avatar_id);
-  cache.SetManagedUserIdOfProfileAtIndex(index, managed_user_id);
+  cache.SetSupervisedUserIdOfProfileAtIndex(index, supervised_user_id);
   // SetNameOfProfileAtIndex may reshuffle the list of profiles, so we do it
   // last.
   cache.SetNameOfProfileAtIndex(index, user_name);
@@ -139,6 +140,17 @@ void TestingProfileManager::DeleteTestingProfile(const std::string& name) {
   profile_manager_->profiles_info_.erase(profile->GetPath());
 }
 
+void TestingProfileManager::DeleteAllTestingProfiles() {
+  for (TestingProfilesMap::iterator it = testing_profiles_.begin();
+       it != testing_profiles_.end(); ++it) {
+    TestingProfile* profile = it->second;
+    ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache();
+    cache.DeleteProfileFromCache(profile->GetPath());
+  }
+  testing_profiles_.clear();
+}
+
+
 void TestingProfileManager::DeleteGuestProfile() {
   DCHECK(called_set_up_);