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

Side by Side Diff: chrome/browser/ui/autofill/save_card_bubble_controller_impl_unittest.cc

Issue 2789843004: [Payments] Upload card UI now has a CVC prompt (Closed)
Patch Set: Android should still not know about SaveCardBubbleController Created 3 years, 8 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 "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" 5 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 71
72 void SetLegalMessage(const std::string& message_json) { 72 void SetLegalMessage(const std::string& message_json) {
73 std::unique_ptr<base::Value> value(base::JSONReader::Read(message_json)); 73 std::unique_ptr<base::Value> value(base::JSONReader::Read(message_json));
74 ASSERT_TRUE(value); 74 ASSERT_TRUE(value);
75 base::DictionaryValue* dictionary; 75 base::DictionaryValue* dictionary;
76 ASSERT_TRUE(value->GetAsDictionary(&dictionary)); 76 ASSERT_TRUE(value->GetAsDictionary(&dictionary));
77 std::unique_ptr<base::DictionaryValue> legal_message = 77 std::unique_ptr<base::DictionaryValue> legal_message =
78 dictionary->CreateDeepCopy(); 78 dictionary->CreateDeepCopy();
79 controller()->ShowBubbleForUpload(CreditCard(), std::move(legal_message), 79 controller()->ShowBubbleForUpload(CreditCard(), std::move(legal_message),
80 bool() /* should_cvc_be_requested */,
Evan Stade 2017/04/07 02:14:39 This should be false, rather than bool(). Could y
Jared Saul 2017/04/08 01:05:36 Added tests for ShouldRequestCvcFromUser()'s value
Evan Stade 2017/04/10 18:32:09 you can use TEST_P for parameterization but what y
Jared Saul 2017/04/11 00:53:05 Acknowledged.
80 base::Bind(&SaveCardCallback)); 81 base::Bind(&SaveCardCallback));
81 } 82 }
82 83
83 void ShowLocalBubble() { 84 void ShowLocalBubble() {
84 controller()->ShowBubbleForLocalSave(CreditCard(), 85 controller()->ShowBubbleForLocalSave(CreditCard(),
85 base::Bind(&SaveCardCallback)); 86 base::Bind(&SaveCardCallback));
86 } 87 }
87 88
88 void ShowUploadBubble() { 89 void ShowUploadBubble() {
89 SetLegalMessage( 90 SetLegalMessage(
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 EXPECT_THAT( 368 EXPECT_THAT(
368 histogram_tester.GetAllSamples( 369 histogram_tester.GetAllSamples(
369 "Autofill.SaveCreditCardPrompt.Upload.FirstShow"), 370 "Autofill.SaveCreditCardPrompt.Upload.FirstShow"),
370 ElementsAre( 371 ElementsAre(
371 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1), 372 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
372 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_INVALID_LEGAL_MESSAGE, 373 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_INVALID_LEGAL_MESSAGE,
373 1))); 374 1)));
374 } 375 }
375 376
376 } // namespace autofill 377 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698