| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.h" | 5 #import "chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 SelectingCredentialInformsModelAndClosesDialog) { | 150 SelectingCredentialInformsModelAndClosesDialog) { |
| 151 ScopedVector<autofill::PasswordForm> local_forms; | 151 ScopedVector<autofill::PasswordForm> local_forms; |
| 152 local_forms.push_back(Credential("pizza")); | 152 local_forms.push_back(Credential("pizza")); |
| 153 ScopedVector<autofill::PasswordForm> federated_forms; | 153 ScopedVector<autofill::PasswordForm> federated_forms; |
| 154 federated_forms.push_back(Credential("taco")); | 154 federated_forms.push_back(Credential("taco")); |
| 155 EXPECT_TRUE(ui_controller()->OnChooseCredentials( | 155 EXPECT_TRUE(ui_controller()->OnChooseCredentials( |
| 156 local_forms.Pass(), | 156 local_forms.Pass(), |
| 157 federated_forms.Pass(), | 157 federated_forms.Pass(), |
| 158 GURL("http://example.com"), | 158 GURL("http://example.com"), |
| 159 base::Callback<void(const password_manager::CredentialInfo&)>())); | 159 base::Callback<void(const password_manager::CredentialInfo&)>())); |
| 160 EXPECT_EQ(password_manager::ui::CREDENTIAL_REQUEST_STATE, | |
| 161 ui_controller()->state()); | |
| 162 [controller().credentialsView | 160 [controller().credentialsView |
| 163 selectRowIndexes:[NSIndexSet indexSetWithIndex:1] | 161 selectRowIndexes:[NSIndexSet indexSetWithIndex:1] |
| 164 byExtendingSelection:NO]; | 162 byExtendingSelection:NO]; |
| 165 EXPECT_TRUE(delegate().dismissed); | 163 EXPECT_TRUE(delegate().dismissed); |
| 166 EXPECT_EQ(password_manager::ui::CREDENTIAL_REQUEST_STATE, | |
| 167 ui_controller()->state()); | |
| 168 EXPECT_TRUE(ui_controller()->choose_credential()); | 164 EXPECT_TRUE(ui_controller()->choose_credential()); |
| 169 EXPECT_EQ(base::ASCIIToUTF16("taco"), | 165 EXPECT_EQ(base::ASCIIToUTF16("taco"), |
| 170 ui_controller()->chosen_credential().username_value); | 166 ui_controller()->chosen_credential().username_value); |
| 171 } | 167 } |
| 172 | 168 |
| 173 TEST_F(ManagePasswordsBubbleAccountChooserViewControllerTest, | 169 TEST_F(ManagePasswordsBubbleAccountChooserViewControllerTest, |
| 174 SelectingNopeDismissesDialog) { | 170 SelectingNopeDismissesDialog) { |
| 175 ScopedVector<autofill::PasswordForm> local_forms; | 171 ScopedVector<autofill::PasswordForm> local_forms; |
| 176 local_forms.push_back(Credential("pizza")); | 172 local_forms.push_back(Credential("pizza")); |
| 177 EXPECT_TRUE(ui_controller()->OnChooseCredentials( | 173 EXPECT_TRUE(ui_controller()->OnChooseCredentials( |
| (...skipping 18 matching lines...) Expand all Loading... |
| 196 SelectingLearnMoreShowsHelpCenterArticle) { | 192 SelectingLearnMoreShowsHelpCenterArticle) { |
| 197 BubbleCombobox* moreButton = controller().moreButton; | 193 BubbleCombobox* moreButton = controller().moreButton; |
| 198 EXPECT_TRUE(moreButton); | 194 EXPECT_TRUE(moreButton); |
| 199 [[moreButton menu] performActionForItemAtIndex: | 195 [[moreButton menu] performActionForItemAtIndex: |
| 200 AccountChooserMoreComboboxModel::INDEX_LEARN_MORE]; | 196 AccountChooserMoreComboboxModel::INDEX_LEARN_MORE]; |
| 201 EXPECT_TRUE(delegate().dismissed); | 197 EXPECT_TRUE(delegate().dismissed); |
| 202 // TODO(dconnelly): Test this when the article is written. | 198 // TODO(dconnelly): Test this when the article is written. |
| 203 } | 199 } |
| 204 | 200 |
| 205 } // namespace | 201 } // namespace |
| OLD | NEW |