Chromium Code Reviews| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 SelectingCredentialInformsModelAndClosesDialog) { | 149 SelectingCredentialInformsModelAndClosesDialog) { |
| 150 ScopedVector<autofill::PasswordForm> local_forms; | 150 ScopedVector<autofill::PasswordForm> local_forms; |
| 151 local_forms.push_back(Credential("pizza")); | 151 local_forms.push_back(Credential("pizza")); |
| 152 ScopedVector<autofill::PasswordForm> federated_forms; | 152 ScopedVector<autofill::PasswordForm> federated_forms; |
| 153 federated_forms.push_back(Credential("taco")); | 153 federated_forms.push_back(Credential("taco")); |
| 154 EXPECT_TRUE(ui_controller()->OnChooseCredentials( | 154 EXPECT_TRUE(ui_controller()->OnChooseCredentials( |
| 155 local_forms.Pass(), | 155 local_forms.Pass(), |
| 156 federated_forms.Pass(), | 156 federated_forms.Pass(), |
| 157 GURL("http://example.com"), | 157 GURL("http://example.com"), |
| 158 base::Callback<void(const password_manager::CredentialInfo&)>())); | 158 base::Callback<void(const password_manager::CredentialInfo&)>())); |
| 159 EXPECT_EQ(password_manager::ui::CREDENTIAL_REQUEST_STATE, | |
|
vabr (Chromium)
2015/11/18 08:59:45
Why is it OK to remove these checks?
vasilii
2015/11/18 12:27:45
Because it tests the mock UI controller. This clas
vabr (Chromium)
2015/11/18 12:36:40
Acknowledged.
| |
| 160 ui_controller()->state()); | |
| 161 [controller().credentialsView | 159 [controller().credentialsView |
| 162 selectRowIndexes:[NSIndexSet indexSetWithIndex:1] | 160 selectRowIndexes:[NSIndexSet indexSetWithIndex:1] |
| 163 byExtendingSelection:NO]; | 161 byExtendingSelection:NO]; |
| 164 EXPECT_TRUE(delegate().dismissed); | 162 EXPECT_TRUE(delegate().dismissed); |
| 165 EXPECT_EQ(password_manager::ui::CREDENTIAL_REQUEST_STATE, | |
| 166 ui_controller()->state()); | |
| 167 EXPECT_TRUE(ui_controller()->choose_credential()); | 163 EXPECT_TRUE(ui_controller()->choose_credential()); |
| 168 EXPECT_EQ(base::ASCIIToUTF16("taco"), | 164 EXPECT_EQ(base::ASCIIToUTF16("taco"), |
| 169 ui_controller()->chosen_credential().username_value); | 165 ui_controller()->chosen_credential().username_value); |
| 170 } | 166 } |
| 171 | 167 |
| 172 TEST_F(ManagePasswordsBubbleAccountChooserViewControllerTest, | 168 TEST_F(ManagePasswordsBubbleAccountChooserViewControllerTest, |
| 173 SelectingNopeDismissesDialog) { | 169 SelectingNopeDismissesDialog) { |
| 174 ScopedVector<autofill::PasswordForm> local_forms; | 170 ScopedVector<autofill::PasswordForm> local_forms; |
| 175 local_forms.push_back(Credential("pizza")); | 171 local_forms.push_back(Credential("pizza")); |
| 176 EXPECT_TRUE(ui_controller()->OnChooseCredentials( | 172 EXPECT_TRUE(ui_controller()->OnChooseCredentials( |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 195 SelectingLearnMoreShowsHelpCenterArticle) { | 191 SelectingLearnMoreShowsHelpCenterArticle) { |
| 196 BubbleCombobox* moreButton = controller().moreButton; | 192 BubbleCombobox* moreButton = controller().moreButton; |
| 197 EXPECT_TRUE(moreButton); | 193 EXPECT_TRUE(moreButton); |
| 198 [[moreButton menu] performActionForItemAtIndex: | 194 [[moreButton menu] performActionForItemAtIndex: |
| 199 AccountChooserMoreComboboxModel::INDEX_LEARN_MORE]; | 195 AccountChooserMoreComboboxModel::INDEX_LEARN_MORE]; |
| 200 EXPECT_TRUE(delegate().dismissed); | 196 EXPECT_TRUE(delegate().dismissed); |
| 201 // TODO(dconnelly): Test this when the article is written. | 197 // TODO(dconnelly): Test this when the article is written. |
| 202 } | 198 } |
| 203 | 199 |
| 204 } // namespace | 200 } // namespace |
| OLD | NEW |