| OLD | NEW |
| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 private: | 119 private: |
| 120 std::unique_ptr<TestSaveCardBubbleView> save_card_bubble_view_; | 120 std::unique_ptr<TestSaveCardBubbleView> save_card_bubble_view_; |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 static void SaveCardCallback() {} | 123 static void SaveCardCallback() {} |
| 124 | 124 |
| 125 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleControllerImplTest); | 125 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleControllerImplTest); |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 // Tests that the legal message lines vector is empty when doing a local save so |
| 129 // that no legal messages will be shown to the user in that case. |
| 130 TEST_F(SaveCardBubbleControllerImplTest, LegalMessageLinesEmptyOnLocalSave) { |
| 131 ShowUploadBubble(); |
| 132 controller()->OnBubbleClosed(); |
| 133 ShowLocalBubble(); |
| 134 EXPECT_TRUE(controller()->GetLegalMessageLines().empty()); |
| 135 } |
| 136 |
| 128 TEST_F(SaveCardBubbleControllerImplTest, Metrics_Local_FirstShow_ShowBubble) { | 137 TEST_F(SaveCardBubbleControllerImplTest, Metrics_Local_FirstShow_ShowBubble) { |
| 129 base::HistogramTester histogram_tester; | 138 base::HistogramTester histogram_tester; |
| 130 ShowLocalBubble(); | 139 ShowLocalBubble(); |
| 131 | 140 |
| 132 EXPECT_THAT( | 141 EXPECT_THAT( |
| 133 histogram_tester.GetAllSamples( | 142 histogram_tester.GetAllSamples( |
| 134 "Autofill.SaveCreditCardPrompt.Local.FirstShow"), | 143 "Autofill.SaveCreditCardPrompt.Local.FirstShow"), |
| 135 ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1), | 144 ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1), |
| 136 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1))); | 145 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1))); |
| 137 } | 146 } |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 EXPECT_THAT( | 364 EXPECT_THAT( |
| 356 histogram_tester.GetAllSamples( | 365 histogram_tester.GetAllSamples( |
| 357 "Autofill.SaveCreditCardPrompt.Upload.FirstShow"), | 366 "Autofill.SaveCreditCardPrompt.Upload.FirstShow"), |
| 358 ElementsAre( | 367 ElementsAre( |
| 359 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1), | 368 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1), |
| 360 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_INVALID_LEGAL_MESSAGE, | 369 Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_INVALID_LEGAL_MESSAGE, |
| 361 1))); | 370 1))); |
| 362 } | 371 } |
| 363 | 372 |
| 364 } // namespace autofill | 373 } // namespace autofill |
| OLD | NEW |