| 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 Profile::EXPLICIT_ACCESS); | 236 Profile::EXPLICIT_ACCESS); |
| 237 ASSERT_TRUE(history); | 237 ASSERT_TRUE(history); |
| 238 | 238 |
| 239 // Profile is new but has more than $(kHistoryEntriesBeforeNewProfilePrompt) | 239 // Profile is new but has more than $(kHistoryEntriesBeforeNewProfilePrompt) |
| 240 // history items. | 240 // history items. |
| 241 char buf[18]; | 241 char buf[18]; |
| 242 for (int i = 0; i < 10; i++) { | 242 for (int i = 0; i < 10; i++) { |
| 243 base::snprintf(buf, arraysize(buf), "http://foo.com/%d", i); | 243 base::snprintf(buf, arraysize(buf), "http://foo.com/%d", i); |
| 244 history->AddPage( | 244 history->AddPage( |
| 245 GURL(std::string(buf)), base::Time::Now(), NULL, 1, | 245 GURL(std::string(buf)), base::Time::Now(), NULL, 1, |
| 246 GURL(), history::RedirectList(), content::PAGE_TRANSITION_LINK, | 246 GURL(), history::RedirectList(), ui::PAGE_TRANSITION_LINK, |
| 247 history::SOURCE_BROWSED, false); | 247 history::SOURCE_BROWSED, false); |
| 248 } | 248 } |
| 249 EXPECT_TRUE( | 249 EXPECT_TRUE( |
| 250 GetCallbackResult( | 250 GetCallbackResult( |
| 251 base::Bind( | 251 base::Bind( |
| 252 &ui::CheckShouldPromptForNewProfile, | 252 &ui::CheckShouldPromptForNewProfile, |
| 253 profile_.get()))); | 253 profile_.get()))); |
| 254 } | 254 } |
| 255 | 255 |
| 256 // http://crbug.com/393149 | 256 // http://crbug.com/393149 |
| 257 TEST_F(ProfileSigninConfirmationHelperTest, | 257 TEST_F(ProfileSigninConfirmationHelperTest, |
| 258 DISABLED_PromptForNewProfile_TypedURLs) { | 258 DISABLED_PromptForNewProfile_TypedURLs) { |
| 259 HistoryService* history = HistoryServiceFactory::GetForProfile( | 259 HistoryService* history = HistoryServiceFactory::GetForProfile( |
| 260 profile_.get(), | 260 profile_.get(), |
| 261 Profile::EXPLICIT_ACCESS); | 261 Profile::EXPLICIT_ACCESS); |
| 262 ASSERT_TRUE(history); | 262 ASSERT_TRUE(history); |
| 263 | 263 |
| 264 // Profile is new but has a typed URL. | 264 // Profile is new but has a typed URL. |
| 265 history->AddPage( | 265 history->AddPage( |
| 266 GURL("http://example.com"), base::Time::Now(), NULL, 1, | 266 GURL("http://example.com"), base::Time::Now(), NULL, 1, |
| 267 GURL(), history::RedirectList(), content::PAGE_TRANSITION_TYPED, | 267 GURL(), history::RedirectList(), ui::PAGE_TRANSITION_TYPED, |
| 268 history::SOURCE_BROWSED, false); | 268 history::SOURCE_BROWSED, false); |
| 269 EXPECT_TRUE( | 269 EXPECT_TRUE( |
| 270 GetCallbackResult( | 270 GetCallbackResult( |
| 271 base::Bind( | 271 base::Bind( |
| 272 &ui::CheckShouldPromptForNewProfile, | 272 &ui::CheckShouldPromptForNewProfile, |
| 273 profile_.get()))); | 273 profile_.get()))); |
| 274 } | 274 } |
| 275 | 275 |
| 276 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Restarted) { | 276 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Restarted) { |
| 277 // Browser has been shut down since profile was created. | 277 // Browser has been shut down since profile was created. |
| 278 user_prefs_->set_read_error(PersistentPrefStore::PREF_READ_ERROR_NONE); | 278 user_prefs_->set_read_error(PersistentPrefStore::PREF_READ_ERROR_NONE); |
| 279 EXPECT_TRUE( | 279 EXPECT_TRUE( |
| 280 GetCallbackResult( | 280 GetCallbackResult( |
| 281 base::Bind( | 281 base::Bind( |
| 282 &ui::CheckShouldPromptForNewProfile, | 282 &ui::CheckShouldPromptForNewProfile, |
| 283 profile_.get()))); | 283 profile_.get()))); |
| 284 } | 284 } |
| OLD | NEW |