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

Unified Diff: components/page_load_metrics/browser/metrics_web_contents_observer_unittest.cc

Issue 1441393002: Add UMA to count the number of Google CAPTCHA pages shown and solved by users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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: components/page_load_metrics/browser/metrics_web_contents_observer_unittest.cc
diff --git a/components/page_load_metrics/browser/metrics_web_contents_observer_unittest.cc b/components/page_load_metrics/browser/metrics_web_contents_observer_unittest.cc
index de5431f8f1e43b2c86523cc5b6def588104a4667..5d37199ae52a3a3213f288dfa9bd8fe1227b8419 100644
--- a/components/page_load_metrics/browser/metrics_web_contents_observer_unittest.cc
+++ b/components/page_load_metrics/browser/metrics_web_contents_observer_unittest.cc
@@ -7,10 +7,12 @@
#include "base/memory/scoped_ptr.h"
#include "base/process/kill.h"
#include "base/test/histogram_tester.h"
+#include "base/test/user_action_tester.h"
#include "base/time/time.h"
#include "components/page_load_metrics/common/page_load_metrics_messages.h"
#include "components/rappor/rappor_utils.h"
#include "components/rappor/test_rappor_service.h"
+#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/test/test_renderer_host.h"
@@ -97,6 +99,7 @@ class MetricsWebContentsObserverTest
protected:
base::HistogramTester histogram_tester_;
+ base::UserActionTester user_action_tester_;
rappor::TestRapporService rappor_tester_;
scoped_ptr<MetricsWebContentsObserver> observer_;
@@ -676,4 +679,28 @@ TEST_F(MetricsWebContentsObserverTest, RapporQuickPageLoad) {
EXPECT_EQ(0u, flag_it->second);
}
+TEST_F(MetricsWebContentsObserverTest, IsGoogleCaptcha) {
+ {
Alexei Svitkine (slow) 2015/11/13 17:45:12 Nit: Can you make this a table driven test?
Matt Welsh 2015/11/13 19:37:16 Done.
+ EXPECT_FALSE(IsGoogleCaptcha(GURL()));
+ }
+ {
+ EXPECT_FALSE(IsGoogleCaptcha(GURL("http://www.cnn.com/")));
+ }
+ {
+ EXPECT_FALSE(IsGoogleCaptcha(GURL("http://ipv4.google.com/")));
+ }
+ {
+ EXPECT_TRUE(IsGoogleCaptcha(
+ GURL("https://ipv4.google.com/sorry/IndexRedirect?continue=http://a")));
+ }
+ {
+ EXPECT_TRUE(IsGoogleCaptcha(
+ GURL("https://ipv6.google.com/sorry/IndexRedirect?continue=http://a")));
+ }
+ {
+ EXPECT_FALSE(IsGoogleCaptcha(
+ GURL("https://ipv7.google.com/sorry/IndexRedirect?continue=http://a")));
+ }
+}
+
} // namespace page_load_metrics

Powered by Google App Engine
This is Rietveld 408576698