| OLD | NEW | 
|    1 // Copyright 2017 The Chromium Authors. All rights reserved. |    1 // Copyright 2017 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/memory/ptr_util.h" |    5 #include "base/memory/ptr_util.h" | 
|    6 #include "base/run_loop.h" |    6 #include "base/run_loop.h" | 
|    7 #include "base/scoped_observer.h" |    7 #include "base/scoped_observer.h" | 
|    8 #include "chrome/browser/browser_process.h" |    8 #include "chrome/browser/browser_process.h" | 
|    9 #include "chrome/browser/browsing_data/browsing_data_remover.h" |  | 
|   10 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |  | 
|   11 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" |  | 
|   12 #include "chrome/browser/chrome_notification_types.h" |    9 #include "chrome/browser/chrome_notification_types.h" | 
|   13 #include "chrome/browser/profiles/profile_attributes_storage.h" |   10 #include "chrome/browser/profiles/profile_attributes_storage.h" | 
|   14 #include "chrome/browser/profiles/profile_manager.h" |   11 #include "chrome/browser/profiles/profile_manager.h" | 
|   15 #include "chrome/browser/ui/browser.h" |   12 #include "chrome/browser/ui/browser.h" | 
|   16 #include "chrome/browser/ui/browser_list.h" |   13 #include "chrome/browser/ui/browser_list.h" | 
|   17 #include "chrome/browser/ui/browser_list_observer.h" |   14 #include "chrome/browser/ui/browser_list_observer.h" | 
|   18 #include "chrome/browser/ui/webui/profile_helper.h" |   15 #include "chrome/browser/ui/webui/profile_helper.h" | 
|   19 #include "chrome/test/base/in_process_browser_test.h" |   16 #include "chrome/test/base/in_process_browser_test.h" | 
 |   17 #include "content/public/browser/browsing_data_remover.h" | 
|   20 #include "content/public/browser/notification_service.h" |   18 #include "content/public/browser/notification_service.h" | 
 |   19 #include "content/public/test/browsing_data_remover_test_util.h" | 
|   21 #include "content/public/test/test_utils.h" |   20 #include "content/public/test/test_utils.h" | 
|   22 #include "content/public/test/test_web_ui.h" |   21 #include "content/public/test/test_web_ui.h" | 
|   23  |   22  | 
|   24 namespace { |   23 namespace { | 
|   25  |   24  | 
|   26 // An observer that returns back to test code after a new profile is |   25 // An observer that returns back to test code after a new profile is | 
|   27 // initialized. |   26 // initialized. | 
|   28 void UnblockOnProfileCreation(base::RunLoop* run_loop, |   27 void UnblockOnProfileCreation(base::RunLoop* run_loop, | 
|   29                               Profile* profile, |   28                               Profile* profile, | 
|   30                               Profile::CreateStatus status) { |   29                               Profile::CreateStatus status) { | 
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  177       g_browser_process->profile_manager()->GetProfileAttributesStorage(); |  176       g_browser_process->profile_manager()->GetProfileAttributesStorage(); | 
|  178  |  177  | 
|  179   BrowserList* browser_list = BrowserList::GetInstance(); |  178   BrowserList* browser_list = BrowserList::GetInstance(); | 
|  180   EXPECT_EQ(1u, browser_list->size()); |  179   EXPECT_EQ(1u, browser_list->size()); | 
|  181   EXPECT_TRUE(base::ContainsValue(*browser_list, original_browser)); |  180   EXPECT_TRUE(base::ContainsValue(*browser_list, original_browser)); | 
|  182   EXPECT_EQ(1u, storage.GetNumberOfProfiles()); |  181   EXPECT_EQ(1u, storage.GetNumberOfProfiles()); | 
|  183  |  182  | 
|  184   Profile* additional_profile = CreateProfile(); |  183   Profile* additional_profile = CreateProfile(); | 
|  185   EXPECT_EQ(2u, storage.GetNumberOfProfiles()); |  184   EXPECT_EQ(2u, storage.GetNumberOfProfiles()); | 
|  186  |  185  | 
|  187   BrowsingDataRemoverCompletionInhibitor inhibitor( |  186   content::BrowsingDataRemoverCompletionInhibitor inhibitor( | 
|  188       BrowsingDataRemoverFactory::GetForBrowserContext(additional_profile)); |  187       content::BrowserContext::GetBrowsingDataRemover(additional_profile)); | 
|  189   webui::DeleteProfileAtPath(additional_profile->GetPath(), &web_ui, |  188   webui::DeleteProfileAtPath(additional_profile->GetPath(), &web_ui, | 
|  190                              ProfileMetrics::DELETE_PROFILE_SETTINGS); |  189                              ProfileMetrics::DELETE_PROFILE_SETTINGS); | 
|  191   inhibitor.BlockUntilNearCompletion(); |  190   inhibitor.BlockUntilNearCompletion(); | 
|  192   inhibitor.ContinueToCompletion(); |  191   inhibitor.ContinueToCompletion(); | 
|  193  |  192  | 
|  194   EXPECT_EQ(1u, browser_list->size()); |  193   EXPECT_EQ(1u, browser_list->size()); | 
|  195   EXPECT_TRUE(base::ContainsValue(*browser_list, original_browser)); |  194   EXPECT_TRUE(base::ContainsValue(*browser_list, original_browser)); | 
|  196   EXPECT_EQ(1u, storage.GetNumberOfProfiles()); |  195   EXPECT_EQ(1u, storage.GetNumberOfProfiles()); | 
|  197 } |  196 } | 
| OLD | NEW |