Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc

Issue 1151373006: Update Confirmation UI for saved password change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/metrics/histogram_samples.h" 5 #include "base/metrics/histogram_samples.h"
6 #include "base/prefs/pref_service.h" 6 #include "base/prefs/pref_service.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "base/test/histogram_tester.h" 8 #include "base/test/histogram_tester.h"
9 #include "chrome/browser/ui/passwords/manage_passwords_bubble.h" 9 #include "chrome/browser/ui/passwords/manage_passwords_bubble.h"
10 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" 10 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
(...skipping 27 matching lines...) Expand all
38 38
39 void TearDown() override { model_.reset(); } 39 void TearDown() override { model_.reset(); }
40 40
41 PrefService* prefs() { return profile_.GetPrefs(); } 41 PrefService* prefs() { return profile_.GetPrefs(); }
42 42
43 void PretendPasswordWaiting() { 43 void PretendPasswordWaiting() {
44 model_->set_state(password_manager::ui::PENDING_PASSWORD_STATE); 44 model_->set_state(password_manager::ui::PENDING_PASSWORD_STATE);
45 model_->OnBubbleShown(ManagePasswordsBubble::AUTOMATIC); 45 model_->OnBubbleShown(ManagePasswordsBubble::AUTOMATIC);
46 } 46 }
47 47
48 void PretendUpdatePasswordWaiting() {
49 model_->set_state(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE);
50 model_->OnBubbleShown(ManagePasswordsBubble::AUTOMATIC);
51 }
52
48 void PretendCredentialsWaiting() { 53 void PretendCredentialsWaiting() {
49 model_->set_state(password_manager::ui::CREDENTIAL_REQUEST_STATE); 54 model_->set_state(password_manager::ui::CREDENTIAL_REQUEST_STATE);
50 model_->OnBubbleShown(ManagePasswordsBubble::AUTOMATIC); 55 model_->OnBubbleShown(ManagePasswordsBubble::AUTOMATIC);
51 } 56 }
52 57
53 void PretendAutoSigningIn() { 58 void PretendAutoSigningIn() {
54 model_->set_state(password_manager::ui::AUTO_SIGNIN_STATE); 59 model_->set_state(password_manager::ui::AUTO_SIGNIN_STATE);
55 model_->OnBubbleShown(ManagePasswordsBubble::AUTOMATIC); 60 model_->OnBubbleShown(ManagePasswordsBubble::AUTOMATIC);
56 } 61 }
57 62
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 password_manager::metrics_util::AUTO_SIGNIN_TOAST_CLICKED); 304 password_manager::metrics_util::AUTO_SIGNIN_TOAST_CLICKED);
300 model_->OnBubbleHidden(); 305 model_->OnBubbleHidden();
301 306
302 EXPECT_TRUE(controller()->manage_accounts()); 307 EXPECT_TRUE(controller()->manage_accounts());
303 308
304 histogram_tester.ExpectUniqueSample( 309 histogram_tester.ExpectUniqueSample(
305 kUIDismissalReasonMetric, 310 kUIDismissalReasonMetric,
306 password_manager::metrics_util::AUTO_SIGNIN_TOAST_CLICKED, 311 password_manager::metrics_util::AUTO_SIGNIN_TOAST_CLICKED,
307 1); 312 1);
308 } 313 }
314
315 TEST_F(ManagePasswordsBubbleModelTest, ClickUpdate) {
316 PretendUpdatePasswordWaiting();
317 model_->OnUpdateClicked(autofill::PasswordForm());
318 model_->OnBubbleHidden();
319 EXPECT_EQ(password_manager::ui::MANAGE_STATE, model_->state());
320 EXPECT_TRUE(controller()->updated_password());
321 EXPECT_FALSE(controller()->never_saved_password());
322 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/passwords/manage_passwords_bubble_model.cc ('k') | chrome/browser/ui/passwords/manage_passwords_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698