OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "chrome/browser/google/google_search_counter.h" | 7 #include "chrome/browser/google/google_search_counter.h" |
8 #include "chrome/browser/google/google_search_counter_android.h" | 8 #include "chrome/browser/google/google_search_counter_android.h" |
9 #include "chrome/browser/prerender/prerender_manager.h" | 9 #include "chrome/browser/prerender/prerender_manager.h" |
10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 public: | 24 public: |
25 MOCK_CONST_METHOD2(RecordAndroidGoogleSearch, | 25 MOCK_CONST_METHOD2(RecordAndroidGoogleSearch, |
26 void(AccessPoint ap, bool prerender_enabled)); | 26 void(AccessPoint ap, bool prerender_enabled)); |
27 }; | 27 }; |
28 | 28 |
29 } // namespace | 29 } // namespace |
30 | 30 |
31 class GoogleSearchCounterAndroidTest : public testing::Test { | 31 class GoogleSearchCounterAndroidTest : public testing::Test { |
32 protected: | 32 protected: |
33 GoogleSearchCounterAndroidTest(); | 33 GoogleSearchCounterAndroidTest(); |
34 virtual ~GoogleSearchCounterAndroidTest(); | 34 ~GoogleSearchCounterAndroidTest() override; |
35 | 35 |
36 // testing::Test | 36 // testing::Test |
37 virtual void SetUp(); | 37 void SetUp() override; |
38 virtual void TearDown(); | 38 void TearDown() override; |
39 | 39 |
40 // Test if |url| is a Google search for specific types. When |is_omnibox| is | 40 // Test if |url| is a Google search for specific types. When |is_omnibox| is |
41 // true, this method will append Omnibox identifiers to the simulated URL | 41 // true, this method will append Omnibox identifiers to the simulated URL |
42 // navigation. If |expected_metric| is set and not AP_BOUNDARY, we'll also use | 42 // navigation. If |expected_metric| is set and not AP_BOUNDARY, we'll also use |
43 // the Search Metrics mock class to ensure that the type of metric recorded is | 43 // the Search Metrics mock class to ensure that the type of metric recorded is |
44 // correct. Note that when |expected_metric| is AP_BOUNDARY, we strictly | 44 // correct. Note that when |expected_metric| is AP_BOUNDARY, we strictly |
45 // forbid any metrics from being logged at all. See implementation below for | 45 // forbid any metrics from being logged at all. See implementation below for |
46 // details. | 46 // details. |
47 void TestGoogleSearch(const std::string& url, | 47 void TestGoogleSearch(const std::string& url, |
48 bool is_omnibox, | 48 bool is_omnibox, |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 TestGoogleSearch("http://www.google.com/webhp?source=search_app", | 170 TestGoogleSearch("http://www.google.com/webhp?source=search_app", |
171 false, GoogleSearchMetrics::AP_BOUNDARY, true); | 171 false, GoogleSearchMetrics::AP_BOUNDARY, true); |
172 } | 172 } |
173 | 173 |
174 TEST_F(GoogleSearchCounterAndroidTest, GoodOmniboxSearch_PrerenderDisabled) { | 174 TEST_F(GoogleSearchCounterAndroidTest, GoodOmniboxSearch_PrerenderDisabled) { |
175 prerender::PrerenderManager::SetMode( | 175 prerender::PrerenderManager::SetMode( |
176 prerender::PrerenderManager::PRERENDER_MODE_DISABLED); | 176 prerender::PrerenderManager::PRERENDER_MODE_DISABLED); |
177 TestGoogleSearch("http://www.google.com/search?q=something", true, | 177 TestGoogleSearch("http://www.google.com/search?q=something", true, |
178 GoogleSearchMetrics::AP_OMNIBOX, false); | 178 GoogleSearchMetrics::AP_OMNIBOX, false); |
179 } | 179 } |
OLD | NEW |