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

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

Issue 11782002: Reverting r174957 and r175112 because ProfileBrowserTest are timing out a lot. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | « no previous file | no next file » | 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 "chrome/browser/profiles/profile.h" 5 #include "chrome/browser/profiles/profile.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/platform_file.h" 9 #include "base/platform_file.h"
10 #include "base/version.h" 10 #include "base/version.h"
11 #include "chrome/browser/prefs/pref_service.h" 11 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/browser/profiles/chrome_version_service.h" 12 #include "chrome/browser/profiles/chrome_version_service.h"
13 #include "chrome/browser/profiles/profile_impl.h" 13 #include "chrome/browser/profiles/profile_impl.h"
14 #include "chrome/common/chrome_constants.h" 14 #include "chrome/common/chrome_constants.h"
15 #include "chrome/common/chrome_notification_types.h" 15 #include "chrome/common/chrome_notification_types.h"
16 #include "chrome/common/chrome_version_info.h" 16 #include "chrome/common/chrome_version_info.h"
17 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
18 #include "chrome/test/base/in_process_browser_test.h" 18 #include "chrome/test/base/in_process_browser_test.h"
19 #include "chrome/test/base/ui_test_utils.h" 19 #include "chrome/test/base/ui_test_utils.h"
20 #include "content/public/browser/notification_service.h"
21 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
22 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
23 22
24 namespace { 23 namespace {
25 24
26 class MockProfileDelegate : public Profile::Delegate { 25 class MockProfileDelegate : public Profile::Delegate {
27 public: 26 public:
28 MOCK_METHOD3(OnProfileCreated, void(Profile*, bool, bool)); 27 MOCK_METHOD3(OnProfileCreated, void(Profile*, bool, bool));
29 }; 28 };
30 29
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, false)); 87 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, false));
89 88
90 scoped_ptr<Profile> profile(Profile::CreateProfile( 89 scoped_ptr<Profile> profile(Profile::CreateProfile(
91 temp_dir.path(), &delegate, Profile::CREATE_MODE_SYNCHRONOUS)); 90 temp_dir.path(), &delegate, Profile::CREATE_MODE_SYNCHRONOUS));
92 ASSERT_TRUE(profile.get()); 91 ASSERT_TRUE(profile.get());
93 CheckChromeVersion(profile.get(), false); 92 CheckChromeVersion(profile.get(), false);
94 } 93 }
95 94
96 // Test OnProfileCreate is called with is_new_profile set to true when 95 // Test OnProfileCreate is called with is_new_profile set to true when
97 // creating a new profile asynchronously. 96 // creating a new profile asynchronously.
97 // This test is flaky on Linux, Win and Mac. See crbug.com/142787
98 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, 98 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest,
99 CreateNewProfileAsynchronous) { 99 DISABLED_CreateNewProfileAsynchronous) {
100 base::ScopedTempDir temp_dir; 100 base::ScopedTempDir temp_dir;
101 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 101 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
102 102
103 MockProfileDelegate delegate; 103 MockProfileDelegate delegate;
104 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, true)); 104 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, true));
105 content::WindowedNotificationObserver observer(
106 chrome::NOTIFICATION_PROFILE_CREATED,
107 content::NotificationService::AllSources());
108 105
109 scoped_ptr<Profile> profile(Profile::CreateProfile( 106 scoped_ptr<Profile> profile(Profile::CreateProfile(
110 temp_dir.path(), &delegate, Profile::CREATE_MODE_ASYNCHRONOUS)); 107 temp_dir.path(), &delegate, Profile::CREATE_MODE_ASYNCHRONOUS));
111 ASSERT_TRUE(profile.get()); 108 ASSERT_TRUE(profile.get());
112 109
113 // Wait for the profile to be created. 110 // Wait for the profile to be created.
111 content::WindowedNotificationObserver observer(
112 chrome::NOTIFICATION_PROFILE_CREATED,
113 content::Source<Profile>(profile.get()));
114 observer.Wait(); 114 observer.Wait();
115 CheckChromeVersion(profile.get(), true); 115 CheckChromeVersion(profile.get(), true);
116 } 116 }
117 117
118 // Test OnProfileCreate is called with is_new_profile set to false when 118 // Test OnProfileCreate is called with is_new_profile set to false when
119 // creating a profile asynchronously with an existing prefs file. 119 // creating a profile asynchronously with an existing prefs file.
120 // Flaky: http://crbug.com/141517
120 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, 121 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest,
121 CreateOldProfileAsynchronous) { 122 DISABLED_CreateOldProfileAsynchronous) {
122 base::ScopedTempDir temp_dir; 123 base::ScopedTempDir temp_dir;
123 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 124 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
124 CreatePrefsFileInDirectory(temp_dir.path()); 125 CreatePrefsFileInDirectory(temp_dir.path());
125 126
126 MockProfileDelegate delegate; 127 MockProfileDelegate delegate;
127 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, false)); 128 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, false));
128 content::WindowedNotificationObserver observer(
129 chrome::NOTIFICATION_PROFILE_CREATED,
130 content::NotificationService::AllSources());
131
132 scoped_ptr<Profile> profile(Profile::CreateProfile( 129 scoped_ptr<Profile> profile(Profile::CreateProfile(
133 temp_dir.path(), &delegate, Profile::CREATE_MODE_ASYNCHRONOUS)); 130 temp_dir.path(), &delegate, Profile::CREATE_MODE_ASYNCHRONOUS));
134 ASSERT_TRUE(profile.get()); 131 ASSERT_TRUE(profile.get());
135 132
136 // Wait for the profile to be created. 133 // Wait for the profile to be created.
134 content::WindowedNotificationObserver observer(
135 chrome::NOTIFICATION_PROFILE_CREATED,
136 content::Source<Profile>(profile.get()));
137 observer.Wait(); 137 observer.Wait();
138 CheckChromeVersion(profile.get(), false); 138 CheckChromeVersion(profile.get(), false);
139 } 139 }
140 140
141 // Vista bots were timing out often. http://crbug.com/140882
142 #if defined(OS_WIN)
143 #define MAYBE_ProfileReadmeCreated DISABLED_ProfileReadmeCreated
144 #else
145 #define MAYBE_ProfileReadmeCreated ProfileReadmeCreated
146 #endif
147 // Test that a README file is created for profiles that didn't have it. 141 // Test that a README file is created for profiles that didn't have it.
148 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, MAYBE_ProfileReadmeCreated) { 142 // Flaky: http://crbug.com/140882
143 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, DISABLED_ProfileReadmeCreated) {
149 base::ScopedTempDir temp_dir; 144 base::ScopedTempDir temp_dir;
150 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 145 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
151 146
152 MockProfileDelegate delegate; 147 MockProfileDelegate delegate;
153 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, true)); 148 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, true));
154 content::WindowedNotificationObserver observer(
155 chrome::NOTIFICATION_PROFILE_CREATED,
156 content::NotificationService::AllSources());
157 149
158 // No delay before README creation. 150 // No delay before README creation.
159 ProfileImpl::create_readme_delay_ms = 0; 151 ProfileImpl::create_readme_delay_ms = 0;
160 152
161 scoped_ptr<Profile> profile(Profile::CreateProfile( 153 scoped_ptr<Profile> profile(Profile::CreateProfile(
162 temp_dir.path(), &delegate, Profile::CREATE_MODE_ASYNCHRONOUS)); 154 temp_dir.path(), &delegate, Profile::CREATE_MODE_ASYNCHRONOUS));
163 ASSERT_TRUE(profile.get()); 155 ASSERT_TRUE(profile.get());
164 156
165 // Wait for the profile to be created. 157 // Wait for the profile to be created.
158 content::WindowedNotificationObserver observer(
159 chrome::NOTIFICATION_PROFILE_CREATED,
160 content::Source<Profile>(profile.get()));
166 observer.Wait(); 161 observer.Wait();
167 162
168 content::RunAllPendingInMessageLoop(content::BrowserThread::FILE); 163 content::RunAllPendingInMessageLoop(content::BrowserThread::FILE);
169 164
170 // Verify that README exists. 165 // Verify that README exists.
171 EXPECT_TRUE(file_util::PathExists( 166 EXPECT_TRUE(file_util::PathExists(
172 temp_dir.path().Append(chrome::kReadmeFilename))); 167 temp_dir.path().Append(chrome::kReadmeFilename)));
173 } 168 }
174 169
175 // Test that Profile can be deleted before README file is created. 170 // Test that Profile can be deleted before README file is created.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // Subsequent calls to a non-crash value should be ignored. 219 // Subsequent calls to a non-crash value should be ignored.
225 profile->SetExitType(Profile::EXIT_NORMAL); 220 profile->SetExitType(Profile::EXIT_NORMAL);
226 std::string second_call_value(prefs->GetString(prefs::kSessionExitType)); 221 std::string second_call_value(prefs->GetString(prefs::kSessionExitType));
227 EXPECT_EQ(first_call_value, second_call_value); 222 EXPECT_EQ(first_call_value, second_call_value);
228 223
229 // Setting back to a crashed value should work. 224 // Setting back to a crashed value should work.
230 profile->SetExitType(Profile::EXIT_CRASHED); 225 profile->SetExitType(Profile::EXIT_CRASHED);
231 std::string final_value(prefs->GetString(prefs::kSessionExitType)); 226 std::string final_value(prefs->GetString(prefs::kSessionExitType));
232 EXPECT_EQ(crash_value, final_value); 227 EXPECT_EQ(crash_value, final_value);
233 } 228 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698