Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: chrome/browser/profiles/profile_manager_unittest.cc

Issue 24733003: Update defaults for InstantExtended. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up test. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/policy/policy_browsertest.cc ('k') | chrome/browser/search/instant_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/path_service.h" 10 #include "base/path_service.h"
(...skipping 17 matching lines...) Expand all
28 #include "chrome/common/chrome_constants.h" 28 #include "chrome/common/chrome_constants.h"
29 #include "chrome/common/chrome_paths.h" 29 #include "chrome/common/chrome_paths.h"
30 #include "chrome/common/chrome_switches.h" 30 #include "chrome/common/chrome_switches.h"
31 #include "chrome/common/pref_names.h" 31 #include "chrome/common/pref_names.h"
32 #include "chrome/test/base/scoped_testing_local_state.h" 32 #include "chrome/test/base/scoped_testing_local_state.h"
33 #include "chrome/test/base/test_browser_window.h" 33 #include "chrome/test/base/test_browser_window.h"
34 #include "chrome/test/base/testing_browser_process.h" 34 #include "chrome/test/base/testing_browser_process.h"
35 #include "chrome/test/base/testing_profile.h" 35 #include "chrome/test/base/testing_profile.h"
36 #include "content/public/browser/notification_service.h" 36 #include "content/public/browser/notification_service.h"
37 #include "content/public/test/test_browser_thread_bundle.h" 37 #include "content/public/test/test_browser_thread_bundle.h"
38 #include "content/public/test/test_renderer_host.h"
38 #include "testing/gmock/include/gmock/gmock.h" 39 #include "testing/gmock/include/gmock/gmock.h"
39 #include "testing/gtest/include/gtest/gtest.h" 40 #include "testing/gtest/include/gtest/gtest.h"
40 41
41 #if defined(OS_CHROMEOS) 42 #if defined(OS_CHROMEOS)
42 #include "chrome/browser/chromeos/login/mock_user_manager.h" 43 #include "chrome/browser/chromeos/login/mock_user_manager.h"
43 #include "chrome/browser/chromeos/login/user_manager.h" 44 #include "chrome/browser/chromeos/login/user_manager.h"
44 #include "chrome/browser/chromeos/settings/cros_settings.h" 45 #include "chrome/browser/chromeos/settings/cros_settings.h"
45 #include "chrome/browser/chromeos/settings/device_settings_service.h" 46 #include "chrome/browser/chromeos/settings/device_settings_service.h"
46 #include "chromeos/chromeos_switches.h" 47 #include "chromeos/chromeos_switches.h"
47 #endif 48 #endif
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 : local_state_(TestingBrowserProcess::GetGlobal()) { 95 : local_state_(TestingBrowserProcess::GetGlobal()) {
95 } 96 }
96 97
97 virtual void SetUp() { 98 virtual void SetUp() {
98 // Create a new temporary directory, and store the path 99 // Create a new temporary directory, and store the path
99 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 100 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
100 TestingBrowserProcess::GetGlobal()->SetProfileManager( 101 TestingBrowserProcess::GetGlobal()->SetProfileManager(
101 new UnittestProfileManager(temp_dir_.path())); 102 new UnittestProfileManager(temp_dir_.path()));
102 103
103 #if defined(OS_CHROMEOS) 104 #if defined(OS_CHROMEOS)
104 CommandLine* cl = CommandLine::ForCurrentProcess(); 105 CommandLine* cl = CommandLine::ForCurrentProcess();
105 cl->AppendSwitch(switches::kTestType); 106 cl->AppendSwitch(switches::kTestType);
106 #endif 107 #endif
107 } 108 }
108 109
109 virtual void TearDown() { 110 virtual void TearDown() {
110 TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL); 111 TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL);
111 base::RunLoop().RunUntilIdle(); 112 base::RunLoop().RunUntilIdle();
112 } 113 }
113 114
114 // Helper function to create a profile with |name| for a profile |manager|. 115 // Helper function to create a profile with |name| for a profile |manager|.
115 void CreateProfileAsync(ProfileManager* manager, 116 void CreateProfileAsync(ProfileManager* manager,
(...skipping 15 matching lines...) Expand all
131 132
132 // The path to temporary directory used to contain the test operations. 133 // The path to temporary directory used to contain the test operations.
133 base::ScopedTempDir temp_dir_; 134 base::ScopedTempDir temp_dir_;
134 ScopedTestingLocalState local_state_; 135 ScopedTestingLocalState local_state_;
135 136
136 content::TestBrowserThreadBundle thread_bundle_; 137 content::TestBrowserThreadBundle thread_bundle_;
137 138
138 #if defined(OS_CHROMEOS) 139 #if defined(OS_CHROMEOS)
139 chromeos::ScopedTestUserManager test_user_manager_; 140 chromeos::ScopedTestUserManager test_user_manager_;
140 #endif 141 #endif
142
143 // The existence of this object enables tests via RenderViewHostTester.
144 content::RenderViewHostTestEnabler rvh_test_enabler_;
Jered 2013/10/02 16:04:56 Why do we need to change this test that looks tota
samarth 2013/10/02 16:31:12 The root cause is tests that start a new Browser w
141 }; 145 };
142 146
143 TEST_F(ProfileManagerTest, GetProfile) { 147 TEST_F(ProfileManagerTest, GetProfile) {
144 base::FilePath dest_path = temp_dir_.path(); 148 base::FilePath dest_path = temp_dir_.path();
145 dest_path = dest_path.Append(FILE_PATH_LITERAL("New Profile")); 149 dest_path = dest_path.Append(FILE_PATH_LITERAL("New Profile"));
146 150
147 ProfileManager* profile_manager = g_browser_process->profile_manager(); 151 ProfileManager* profile_manager = g_browser_process->profile_manager();
148 152
149 // Successfully create a profile. 153 // Successfully create a profile.
150 Profile* profile = profile_manager->GetProfile(dest_path); 154 Profile* profile = profile_manager->GetProfile(dest_path);
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 dest_path2.BaseName().MaybeAsASCII()); 766 dest_path2.BaseName().MaybeAsASCII());
763 profile_manager->ScheduleProfileForDeletion(dest_path2, 767 profile_manager->ScheduleProfileForDeletion(dest_path2,
764 ProfileManager::CreateCallback()); 768 ProfileManager::CreateCallback());
765 // Spin the message loop so that all the callbacks can finish running. 769 // Spin the message loop so that all the callbacks can finish running.
766 base::RunLoop().RunUntilIdle(); 770 base::RunLoop().RunUntilIdle();
767 771
768 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); 772 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath());
769 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); 773 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed));
770 } 774 }
771 #endif // !defined(OS_MACOSX) 775 #endif // !defined(OS_MACOSX)
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_browsertest.cc ('k') | chrome/browser/search/instant_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698