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

Side by Side Diff: components/autofill/core/browser/autofill_metrics_unittest.cc

Issue 2665313002: Add a counter for clicking on Form-Not-Secure warnings (Closed)
Patch Set: rebase fixup again Created 3 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/autofill/core/browser/autofill_metrics.h" 5 #include "components/autofill/core/browser/autofill_metrics.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/test/histogram_tester.h" 17 #include "base/test/histogram_tester.h"
18 #include "base/test/user_action_tester.h" 18 #include "base/test/user_action_tester.h"
19 #include "base/time/time.h" 19 #include "base/time/time.h"
20 #include "components/autofill/core/browser/autofill_external_delegate.h" 20 #include "components/autofill/core/browser/autofill_external_delegate.h"
21 #include "components/autofill/core/browser/autofill_manager.h" 21 #include "components/autofill/core/browser/autofill_manager.h"
22 #include "components/autofill/core/browser/autofill_test_utils.h" 22 #include "components/autofill/core/browser/autofill_test_utils.h"
23 #include "components/autofill/core/browser/payments/payments_client.h" 23 #include "components/autofill/core/browser/payments/payments_client.h"
24 #include "components/autofill/core/browser/personal_data_manager.h" 24 #include "components/autofill/core/browser/personal_data_manager.h"
25 #include "components/autofill/core/browser/popup_item_ids.h"
25 #include "components/autofill/core/browser/test_autofill_client.h" 26 #include "components/autofill/core/browser/test_autofill_client.h"
26 #include "components/autofill/core/browser/test_autofill_driver.h" 27 #include "components/autofill/core/browser/test_autofill_driver.h"
27 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 28 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
28 #include "components/autofill/core/common/form_data.h" 29 #include "components/autofill/core/common/form_data.h"
29 #include "components/autofill/core/common/form_field_data.h" 30 #include "components/autofill/core/common/form_field_data.h"
30 #include "components/prefs/pref_service.h" 31 #include "components/prefs/pref_service.h"
31 #include "components/rappor/test_rappor_service.h" 32 #include "components/rappor/test_rappor_service.h"
32 #include "components/signin/core/browser/account_tracker_service.h" 33 #include "components/signin/core/browser/account_tracker_service.h"
33 #include "components/signin/core/browser/fake_signin_manager.h" 34 #include "components/signin/core/browser/fake_signin_manager.h"
34 #include "components/signin/core/browser/test_signin_client.h" 35 #include "components/signin/core/browser/test_signin_client.h"
(...skipping 4174 matching lines...) Expand 10 before | Expand all | Expand 10 after
4209 FormStructure::ParseQueryResponse(response_string, forms_, &rappor_service_); 4210 FormStructure::ParseQueryResponse(response_string, forms_, &rappor_service_);
4210 EXPECT_THAT( 4211 EXPECT_THAT(
4211 histogram_tester.GetAllSamples("Autofill.ServerResponseHasDataForForm"), 4212 histogram_tester.GetAllSamples("Autofill.ServerResponseHasDataForForm"),
4212 ElementsAre(Bucket(true, 2))); 4213 ElementsAre(Bucket(true, 2)));
4213 4214
4214 // No RAPPOR metrics are logged in the case there is at least some server data 4215 // No RAPPOR metrics are logged in the case there is at least some server data
4215 // available for all forms. 4216 // available for all forms.
4216 EXPECT_EQ(0, rappor_service_.GetReportsCount()); 4217 EXPECT_EQ(0, rappor_service_.GetReportsCount());
4217 } 4218 }
4218 4219
4220 // Test that the Form-Not-Secure warning user action is recorded.
4221 TEST_F(AutofillMetricsTest, ShowHttpNotSecureExplanationUserAction) {
4222 base::UserActionTester user_action_tester;
4223 external_delegate_->DidAcceptSuggestion(
4224 ASCIIToUTF16("Test"), POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE, 0);
4225 EXPECT_EQ(1, user_action_tester.GetActionCount(
4226 "Autofill_ShowedHttpNotSecureExplanation"));
4227 }
4228
4219 } // namespace autofill 4229 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698