| 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/webui/signin/profile_signin_confirmation_dialog.h" | 5 #include "chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 profile_->CreateHistoryService(true, false); | 135 profile_->CreateHistoryService(true, false); |
| 136 extensions::TestExtensionSystem* system = | 136 extensions::TestExtensionSystem* system = |
| 137 static_cast<extensions::TestExtensionSystem*>( | 137 static_cast<extensions::TestExtensionSystem*>( |
| 138 extensions::ExtensionSystem::Get(profile_.get())); | 138 extensions::ExtensionSystem::Get(profile_.get())); |
| 139 CommandLine command_line(CommandLine::NO_PROGRAM); | 139 CommandLine command_line(CommandLine::NO_PROGRAM); |
| 140 system->CreateExtensionService(&command_line, | 140 system->CreateExtensionService(&command_line, |
| 141 base::FilePath(kExtensionFilePath), | 141 base::FilePath(kExtensionFilePath), |
| 142 false); | 142 false); |
| 143 | 143 |
| 144 // Create a dialog, but don't display it. | 144 // Create a dialog, but don't display it. |
| 145 dialog_ = new ProfileSigninConfirmationDialog( | 145 dialog_ = new ProfileSigninConfirmationDialog(profile_.get(), |
| 146 profile_.get(), "", | 146 std::string(), |
| 147 base::Bind(&base::DoNothing), | 147 base::Bind(&base::DoNothing), |
| 148 base::Bind(&base::DoNothing), | 148 base::Bind(&base::DoNothing), |
| 149 base::Bind(&base::DoNothing)); | 149 base::Bind(&base::DoNothing)); |
| 150 } | 150 } |
| 151 | 151 |
| 152 virtual void TearDown() OVERRIDE { | 152 virtual void TearDown() OVERRIDE { |
| 153 delete dialog_; | 153 delete dialog_; |
| 154 } | 154 } |
| 155 | 155 |
| 156 protected: | 156 protected: |
| 157 MessageLoopForUI message_loop_; | 157 MessageLoopForUI message_loop_; |
| 158 content::TestBrowserThread ui_thread_; | 158 content::TestBrowserThread ui_thread_; |
| 159 scoped_ptr<TestingProfile> profile_; | 159 scoped_ptr<TestingProfile> profile_; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 extensions->extension_prefs()->AddGrantedPermissions( | 197 extensions->extension_prefs()->AddGrantedPermissions( |
| 198 webstore->id(), | 198 webstore->id(), |
| 199 make_scoped_refptr(new extensions::PermissionSet)); | 199 make_scoped_refptr(new extensions::PermissionSet)); |
| 200 extensions->AddExtension(webstore); | 200 extensions->AddExtension(webstore); |
| 201 EXPECT_FALSE( | 201 EXPECT_FALSE( |
| 202 GetCallbackResult( | 202 GetCallbackResult( |
| 203 base::Bind( | 203 base::Bind( |
| 204 &ProfileSigninConfirmationDialog::CheckShouldPromptForNewProfile, | 204 &ProfileSigninConfirmationDialog::CheckShouldPromptForNewProfile, |
| 205 base::Unretained(dialog_)))); | 205 base::Unretained(dialog_)))); |
| 206 | 206 |
| 207 scoped_refptr<extensions::Extension> extension = CreateExtension("foo", ""); | 207 scoped_refptr<extensions::Extension> extension = |
| 208 CreateExtension("foo", std::string()); |
| 208 extensions->extension_prefs()->AddGrantedPermissions( | 209 extensions->extension_prefs()->AddGrantedPermissions( |
| 209 extension->id(), | 210 extension->id(), make_scoped_refptr(new extensions::PermissionSet)); |
| 210 make_scoped_refptr(new extensions::PermissionSet)); | |
| 211 extensions->AddExtension(extension); | 211 extensions->AddExtension(extension); |
| 212 EXPECT_TRUE( | 212 EXPECT_TRUE( |
| 213 GetCallbackResult( | 213 GetCallbackResult( |
| 214 base::Bind( | 214 base::Bind( |
| 215 &ProfileSigninConfirmationDialog::CheckShouldPromptForNewProfile, | 215 &ProfileSigninConfirmationDialog::CheckShouldPromptForNewProfile, |
| 216 base::Unretained(dialog_)))); | 216 base::Unretained(dialog_)))); |
| 217 } | 217 } |
| 218 | 218 |
| 219 TEST_F(ProfileSigninConfirmationDialogTest, PromptForNewProfile_History) { | 219 TEST_F(ProfileSigninConfirmationDialogTest, PromptForNewProfile_History) { |
| 220 HistoryService* history = HistoryServiceFactory::GetForProfile( | 220 HistoryService* history = HistoryServiceFactory::GetForProfile( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 259 |
| 260 TEST_F(ProfileSigninConfirmationDialogTest, PromptForNewProfile_Restarted) { | 260 TEST_F(ProfileSigninConfirmationDialogTest, PromptForNewProfile_Restarted) { |
| 261 // Browser has been shut down since profile was created. | 261 // Browser has been shut down since profile was created. |
| 262 user_prefs_->set_read_error(PersistentPrefStore::PREF_READ_ERROR_NONE); | 262 user_prefs_->set_read_error(PersistentPrefStore::PREF_READ_ERROR_NONE); |
| 263 EXPECT_TRUE( | 263 EXPECT_TRUE( |
| 264 GetCallbackResult( | 264 GetCallbackResult( |
| 265 base::Bind( | 265 base::Bind( |
| 266 &ProfileSigninConfirmationDialog::CheckShouldPromptForNewProfile, | 266 &ProfileSigninConfirmationDialog::CheckShouldPromptForNewProfile, |
| 267 base::Unretained(dialog_)))); | 267 base::Unretained(dialog_)))); |
| 268 } | 268 } |
| OLD | NEW |