| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 | 70 |
| 71 // A pref store that can have its read_error property changed for testing. | 71 // A pref store that can have its read_error property changed for testing. |
| 72 class TestingPrefStoreWithCustomReadError : public TestingPrefStore { | 72 class TestingPrefStoreWithCustomReadError : public TestingPrefStore { |
| 73 public: | 73 public: |
| 74 TestingPrefStoreWithCustomReadError() | 74 TestingPrefStoreWithCustomReadError() |
| 75 : read_error_(PersistentPrefStore::PREF_READ_ERROR_NO_FILE) { | 75 : read_error_(PersistentPrefStore::PREF_READ_ERROR_NO_FILE) { |
| 76 // By default the profile is "new" (NO_FILE means that the profile | 76 // By default the profile is "new" (NO_FILE means that the profile |
| 77 // wasn't found on disk, so it was created). | 77 // wasn't found on disk, so it was created). |
| 78 } | 78 } |
| 79 virtual PrefReadError GetReadError() const override { | 79 PrefReadError GetReadError() const override { return read_error_; } |
| 80 return read_error_; | 80 bool IsInitializationComplete() const override { return true; } |
| 81 } | |
| 82 virtual bool IsInitializationComplete() const override { | |
| 83 return true; | |
| 84 } | |
| 85 void set_read_error(PrefReadError read_error) { | 81 void set_read_error(PrefReadError read_error) { |
| 86 read_error_ = read_error; | 82 read_error_ = read_error; |
| 87 } | 83 } |
| 88 private: | 84 private: |
| 89 virtual ~TestingPrefStoreWithCustomReadError() {} | 85 ~TestingPrefStoreWithCustomReadError() override {} |
| 90 PrefReadError read_error_; | 86 PrefReadError read_error_; |
| 91 }; | 87 }; |
| 92 | 88 |
| 93 #if defined(ENABLE_EXTENSIONS) | 89 #if defined(ENABLE_EXTENSIONS) |
| 94 #if defined(OS_WIN) | 90 #if defined(OS_WIN) |
| 95 const base::FilePath::CharType kExtensionFilePath[] = | 91 const base::FilePath::CharType kExtensionFilePath[] = |
| 96 FILE_PATH_LITERAL("c:\\foo"); | 92 FILE_PATH_LITERAL("c:\\foo"); |
| 97 #elif defined(OS_POSIX) | 93 #elif defined(OS_POSIX) |
| 98 const base::FilePath::CharType kExtensionFilePath[] = | 94 const base::FilePath::CharType kExtensionFilePath[] = |
| 99 FILE_PATH_LITERAL("/oo"); | 95 FILE_PATH_LITERAL("/oo"); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 271 |
| 276 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Restarted) { | 272 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Restarted) { |
| 277 // Browser has been shut down since profile was created. | 273 // Browser has been shut down since profile was created. |
| 278 user_prefs_->set_read_error(PersistentPrefStore::PREF_READ_ERROR_NONE); | 274 user_prefs_->set_read_error(PersistentPrefStore::PREF_READ_ERROR_NONE); |
| 279 EXPECT_TRUE( | 275 EXPECT_TRUE( |
| 280 GetCallbackResult( | 276 GetCallbackResult( |
| 281 base::Bind( | 277 base::Bind( |
| 282 &ui::CheckShouldPromptForNewProfile, | 278 &ui::CheckShouldPromptForNewProfile, |
| 283 profile_.get()))); | 279 profile_.get()))); |
| 284 } | 280 } |
| OLD | NEW |