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

Unified Diff: chrome/renderer/autofill/password_generation_agent_browsertest.cc

Issue 643493003: [Password Generation] Update UMA stats for popups per page not per event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/autofill/password_generation_agent_browsertest.cc
diff --git a/chrome/renderer/autofill/password_generation_agent_browsertest.cc b/chrome/renderer/autofill/password_generation_agent_browsertest.cc
index 60bdaa3efa8a9c77e86dc2d7997968038f342b55..67d04db68212e34216fa563bc35a423dc7f39aaf 100644
--- a/chrome/renderer/autofill/password_generation_agent_browsertest.cc
+++ b/chrome/renderer/autofill/password_generation_agent_browsertest.cc
@@ -5,12 +5,16 @@
#include <string.h>
#include "base/memory/scoped_ptr.h"
+#include "base/metrics/histogram_samples.h"
+#include "base/metrics/statistics_recorder.h"
Ilya Sherman 2014/10/14 20:17:20 nit: Are these two still needed?
Garrett Casto 2014/10/15 00:10:01 Done.
#include "base/strings/utf_string_conversions.h"
+#include "base/test/histogram_tester.h"
#include "chrome/test/base/chrome_render_view_test.h"
#include "components/autofill/content/common/autofill_messages.h"
#include "components/autofill/content/renderer/autofill_agent.h"
#include "components/autofill/content/renderer/test_password_generation_agent.h"
#include "components/autofill/core/common/form_data.h"
+#include "components/autofill/core/common/password_generation_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/web/WebDocument.h"
@@ -328,6 +332,16 @@ TEST_F(PasswordGenerationAgentTest, MaximumOfferSize) {
EXPECT_EQ(AutofillHostMsg_ShowPasswordGenerationPopup::ID,
password_generation_->messages()[0]->type());
password_generation_->clear_messages();
+
+ // Loading a different page triggers UMA stat upload. Verify that only one
+ // display event is sent even though
+ LoadHTML(kSigninFormHTML);
+
+ base::HistogramTester histogram_tester;
+ histogram_tester->ExpectBucketCount(
+ "PasswordGeneration.Event",
+ autofill::password_generation::GENERATION_POPUP_SHOWN,
+ 1);
}
} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698