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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "chrome/browser/browsing_data/browsing_data_remover.h" | |
16 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | |
17 #include "chrome/browser/lifetime/keep_alive_types.h" | 15 #include "chrome/browser/lifetime/keep_alive_types.h" |
18 #include "chrome/browser/lifetime/scoped_keep_alive.h" | 16 #include "chrome/browser/lifetime/scoped_keep_alive.h" |
19 #include "chrome/browser/password_manager/password_store_factory.h" | 17 #include "chrome/browser/password_manager/password_store_factory.h" |
20 #include "chrome/browser/profiles/profile_attributes_entry.h" | 18 #include "chrome/browser/profiles/profile_attributes_entry.h" |
21 #include "chrome/browser/profiles/profile_attributes_storage.h" | 19 #include "chrome/browser/profiles/profile_attributes_storage.h" |
22 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
23 #include "chrome/browser/profiles/profile_window.h" | 21 #include "chrome/browser/profiles/profile_window.h" |
24 #include "chrome/browser/profiles/profiles_state.h" | 22 #include "chrome/browser/profiles/profiles_state.h" |
25 #include "chrome/browser/ui/browser_finder.h" | 23 #include "chrome/browser/ui/browser_finder.h" |
26 #include "chrome/browser/ui/browser_list.h" | 24 #include "chrome/browser/ui/browser_list.h" |
27 #include "chrome/browser/ui/browser_window.h" | 25 #include "chrome/browser/ui/browser_window.h" |
28 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
29 #include "chrome/test/base/in_process_browser_test.h" | 27 #include "chrome/test/base/in_process_browser_test.h" |
30 #include "chrome/test/base/testing_browser_process.h" | 28 #include "chrome/test/base/testing_browser_process.h" |
31 #include "components/autofill/core/common/password_form.h" | 29 #include "components/autofill/core/common/password_form.h" |
32 #include "components/password_manager/core/browser/password_store.h" | 30 #include "components/password_manager/core/browser/password_store.h" |
33 #include "components/password_manager/core/browser/password_store_consumer.h" | 31 #include "components/password_manager/core/browser/password_store_consumer.h" |
34 #include "components/prefs/pref_service.h" | 32 #include "components/prefs/pref_service.h" |
| 33 #include "content/public/browser/browsing_data_remover.h" |
35 #include "content/public/test/test_utils.h" | 34 #include "content/public/test/test_utils.h" |
36 | 35 |
37 #if defined(OS_CHROMEOS) | 36 #if defined(OS_CHROMEOS) |
38 #include "base/path_service.h" | 37 #include "base/path_service.h" |
39 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 38 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
40 #include "chrome/common/chrome_constants.h" | 39 #include "chrome/common/chrome_constants.h" |
41 #include "chrome/common/chrome_paths.h" | 40 #include "chrome/common/chrome_paths.h" |
42 #include "chromeos/chromeos_switches.h" | 41 #include "chromeos/chromeos_switches.h" |
43 #include "testing/gtest/include/gtest/gtest.h" | 42 #include "testing/gtest/include/gtest/gtest.h" |
44 #endif | 43 #endif |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 profiles_data_removed_count_(0) { | 77 profiles_data_removed_count_(0) { |
79 EXPECT_GT(expected_count_, 0u); | 78 EXPECT_GT(expected_count_, 0u); |
80 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 79 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
81 profile_manager->GetProfileAttributesStorage().AddObserver(this); | 80 profile_manager->GetProfileAttributesStorage().AddObserver(this); |
82 | 81 |
83 base::Callback<void(const base::Closure&)> would_complete_callback = | 82 base::Callback<void(const base::Closure&)> would_complete_callback = |
84 base::Bind(&MultipleProfileDeletionObserver:: | 83 base::Bind(&MultipleProfileDeletionObserver:: |
85 OnBrowsingDataRemoverWouldComplete, | 84 OnBrowsingDataRemoverWouldComplete, |
86 base::Unretained(this)); | 85 base::Unretained(this)); |
87 for (Profile* profile : profile_manager->GetLoadedProfiles()) { | 86 for (Profile* profile : profile_manager->GetLoadedProfiles()) { |
88 BrowsingDataRemoverFactory::GetForBrowserContext(profile) | 87 content::BrowserContext::GetBrowsingDataRemover(profile) |
89 ->SetWouldCompleteCallbackForTesting(would_complete_callback); | 88 ->SetWouldCompleteCallbackForTesting(would_complete_callback); |
90 } | 89 } |
91 } | 90 } |
92 | 91 |
93 ~MultipleProfileDeletionObserver() override { | 92 ~MultipleProfileDeletionObserver() override { |
94 g_browser_process->profile_manager()->GetProfileAttributesStorage(). | 93 g_browser_process->profile_manager()->GetProfileAttributesStorage(). |
95 RemoveObserver(this); | 94 RemoveObserver(this); |
96 } | 95 } |
97 | 96 |
98 void Wait() { | 97 void Wait() { |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 | 646 |
648 EXPECT_FALSE(profile->HasOffTheRecordProfile()); | 647 EXPECT_FALSE(profile->HasOffTheRecordProfile()); |
649 EXPECT_FALSE(profile_manager->IsValidProfile(incognito_profile)); | 648 EXPECT_FALSE(profile_manager->IsValidProfile(incognito_profile)); |
650 EXPECT_EQ(initial_profile_count, profile_manager->GetNumberOfProfiles()); | 649 EXPECT_EQ(initial_profile_count, profile_manager->GetNumberOfProfiles()); |
651 // After destroying the incognito profile incognito preferences should be | 650 // After destroying the incognito profile incognito preferences should be |
652 // cleared so the default save path should be taken from the main profile. | 651 // cleared so the default save path should be taken from the main profile. |
653 EXPECT_FALSE(profile->GetOffTheRecordPrefs() | 652 EXPECT_FALSE(profile->GetOffTheRecordPrefs() |
654 ->GetFilePath(prefs::kSaveFileDefaultDirectory) | 653 ->GetFilePath(prefs::kSaveFileDefaultDirectory) |
655 .empty()); | 654 .empty()); |
656 } | 655 } |
OLD | NEW |