| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/sync/profile_signin_confirmation_helper.h" | 5 #include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 TestingPrefStoreWithCustomReadError* user_prefs_; | 162 TestingPrefStoreWithCustomReadError* user_prefs_; |
| 163 BookmarkModel* model_; | 163 BookmarkModel* model_; |
| 164 | 164 |
| 165 #if defined OS_CHROMEOS | 165 #if defined OS_CHROMEOS |
| 166 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; | 166 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; |
| 167 chromeos::ScopedTestCrosSettings test_cros_settings_; | 167 chromeos::ScopedTestCrosSettings test_cros_settings_; |
| 168 chromeos::ScopedTestUserManager test_user_manager_; | 168 chromeos::ScopedTestUserManager test_user_manager_; |
| 169 #endif | 169 #endif |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 TEST_F(ProfileSigninConfirmationHelperTest, DoNotPromptForNewProfile) { | 172 // http://crbug.com/393149 |
| 173 TEST_F(ProfileSigninConfirmationHelperTest, DISABLED_DoNotPromptForNewProfile) { |
| 173 // Profile is new and there's no profile data. | 174 // Profile is new and there's no profile data. |
| 174 EXPECT_FALSE( | 175 EXPECT_FALSE( |
| 175 GetCallbackResult( | 176 GetCallbackResult( |
| 176 base::Bind( | 177 base::Bind( |
| 177 &ui::CheckShouldPromptForNewProfile, | 178 &ui::CheckShouldPromptForNewProfile, |
| 178 profile_.get()))); | 179 profile_.get()))); |
| 179 } | 180 } |
| 180 | 181 |
| 181 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Bookmarks) { | 182 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Bookmarks) { |
| 182 ASSERT_TRUE(model_); | 183 ASSERT_TRUE(model_); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 210 | 211 |
| 211 scoped_refptr<extensions::Extension> extension = | 212 scoped_refptr<extensions::Extension> extension = |
| 212 CreateExtension("foo", std::string()); | 213 CreateExtension("foo", std::string()); |
| 213 extensions::ExtensionPrefs::Get(profile_.get())->AddGrantedPermissions( | 214 extensions::ExtensionPrefs::Get(profile_.get())->AddGrantedPermissions( |
| 214 extension->id(), make_scoped_refptr(new extensions::PermissionSet).get()); | 215 extension->id(), make_scoped_refptr(new extensions::PermissionSet).get()); |
| 215 extensions->AddExtension(extension.get()); | 216 extensions->AddExtension(extension.get()); |
| 216 EXPECT_TRUE(GetCallbackResult( | 217 EXPECT_TRUE(GetCallbackResult( |
| 217 base::Bind(&ui::CheckShouldPromptForNewProfile, profile_.get()))); | 218 base::Bind(&ui::CheckShouldPromptForNewProfile, profile_.get()))); |
| 218 } | 219 } |
| 219 | 220 |
| 220 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_History) { | 221 // http://crbug.com/393149 |
| 222 TEST_F(ProfileSigninConfirmationHelperTest, |
| 223 DISABLED_PromptForNewProfile_History) { |
| 221 HistoryService* history = HistoryServiceFactory::GetForProfile( | 224 HistoryService* history = HistoryServiceFactory::GetForProfile( |
| 222 profile_.get(), | 225 profile_.get(), |
| 223 Profile::EXPLICIT_ACCESS); | 226 Profile::EXPLICIT_ACCESS); |
| 224 ASSERT_TRUE(history); | 227 ASSERT_TRUE(history); |
| 225 | 228 |
| 226 // Profile is new but has more than $(kHistoryEntriesBeforeNewProfilePrompt) | 229 // Profile is new but has more than $(kHistoryEntriesBeforeNewProfilePrompt) |
| 227 // history items. | 230 // history items. |
| 228 char buf[18]; | 231 char buf[18]; |
| 229 for (int i = 0; i < 10; i++) { | 232 for (int i = 0; i < 10; i++) { |
| 230 base::snprintf(buf, arraysize(buf), "http://foo.com/%d", i); | 233 base::snprintf(buf, arraysize(buf), "http://foo.com/%d", i); |
| 231 history->AddPage( | 234 history->AddPage( |
| 232 GURL(std::string(buf)), base::Time::Now(), NULL, 1, | 235 GURL(std::string(buf)), base::Time::Now(), NULL, 1, |
| 233 GURL(), history::RedirectList(), content::PAGE_TRANSITION_LINK, | 236 GURL(), history::RedirectList(), content::PAGE_TRANSITION_LINK, |
| 234 history::SOURCE_BROWSED, false); | 237 history::SOURCE_BROWSED, false); |
| 235 } | 238 } |
| 236 EXPECT_TRUE( | 239 EXPECT_TRUE( |
| 237 GetCallbackResult( | 240 GetCallbackResult( |
| 238 base::Bind( | 241 base::Bind( |
| 239 &ui::CheckShouldPromptForNewProfile, | 242 &ui::CheckShouldPromptForNewProfile, |
| 240 profile_.get()))); | 243 profile_.get()))); |
| 241 } | 244 } |
| 242 | 245 |
| 243 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_TypedURLs) { | 246 // http://crbug.com/393149 |
| 247 TEST_F(ProfileSigninConfirmationHelperTest, |
| 248 DISABLED_PromptForNewProfile_TypedURLs) { |
| 244 HistoryService* history = HistoryServiceFactory::GetForProfile( | 249 HistoryService* history = HistoryServiceFactory::GetForProfile( |
| 245 profile_.get(), | 250 profile_.get(), |
| 246 Profile::EXPLICIT_ACCESS); | 251 Profile::EXPLICIT_ACCESS); |
| 247 ASSERT_TRUE(history); | 252 ASSERT_TRUE(history); |
| 248 | 253 |
| 249 // Profile is new but has a typed URL. | 254 // Profile is new but has a typed URL. |
| 250 history->AddPage( | 255 history->AddPage( |
| 251 GURL("http://example.com"), base::Time::Now(), NULL, 1, | 256 GURL("http://example.com"), base::Time::Now(), NULL, 1, |
| 252 GURL(), history::RedirectList(), content::PAGE_TRANSITION_TYPED, | 257 GURL(), history::RedirectList(), content::PAGE_TRANSITION_TYPED, |
| 253 history::SOURCE_BROWSED, false); | 258 history::SOURCE_BROWSED, false); |
| 254 EXPECT_TRUE( | 259 EXPECT_TRUE( |
| 255 GetCallbackResult( | 260 GetCallbackResult( |
| 256 base::Bind( | 261 base::Bind( |
| 257 &ui::CheckShouldPromptForNewProfile, | 262 &ui::CheckShouldPromptForNewProfile, |
| 258 profile_.get()))); | 263 profile_.get()))); |
| 259 } | 264 } |
| 260 | 265 |
| 261 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Restarted) { | 266 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Restarted) { |
| 262 // Browser has been shut down since profile was created. | 267 // Browser has been shut down since profile was created. |
| 263 user_prefs_->set_read_error(PersistentPrefStore::PREF_READ_ERROR_NONE); | 268 user_prefs_->set_read_error(PersistentPrefStore::PREF_READ_ERROR_NONE); |
| 264 EXPECT_TRUE( | 269 EXPECT_TRUE( |
| 265 GetCallbackResult( | 270 GetCallbackResult( |
| 266 base::Bind( | 271 base::Bind( |
| 267 &ui::CheckShouldPromptForNewProfile, | 272 &ui::CheckShouldPromptForNewProfile, |
| 268 profile_.get()))); | 273 profile_.get()))); |
| 269 } | 274 } |
| OLD | NEW |