Chromium Code Reviews| 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 |