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..d7c5e1920949c16e17e8c980e5320ff848c2e6e0 100644 |
--- a/chrome/renderer/autofill/password_generation_agent_browsertest.cc |
+++ b/chrome/renderer/autofill/password_generation_agent_browsertest.cc |
@@ -5,12 +5,15 @@ |
#include <string.h> |
#include "base/memory/scoped_ptr.h" |
+#include "base/metrics/histogram_samples.h" |
+#include "base/metrics/statistics_recorder.h" |
#include "base/strings/utf_string_conversions.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 +331,19 @@ 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::HistogramBase* event_histogram = |
+ base::StatisticsRecorder::FindHistogram( |
+ "PasswordGeneration.Event"); |
+ ASSERT_TRUE(event_histogram); |
+ scoped_ptr<base::HistogramSamples> snapshot = |
+ event_histogram->SnapshotSamples(); |
+ EXPECT_EQ(1, snapshot->GetCount( |
+ autofill::password_generation::GENERATION_POPUP_SHOWN)); |
Ilya Sherman
2014/10/09 22:03:58
Please use base/test/histogram_tester.h for this.
Garrett Casto
2014/10/14 18:40:05
Neat, didn't know about that. Updated.
|
} |
} // namespace autofill |