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

Side by Side Diff: chrome/browser/google/google_search_counter_unittest.cc

Issue 684613002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/google/google_search_counter.h" 5 #include "chrome/browser/google/google_search_counter.h"
6 #include "components/google/core/browser/google_search_metrics.h" 6 #include "components/google/core/browser/google_search_metrics.h"
7 #include "content/public/browser/navigation_controller.h" 7 #include "content/public/browser/navigation_controller.h"
8 #include "content/public/browser/navigation_details.h" 8 #include "content/public/browser/navigation_details.h"
9 #include "content/public/browser/navigation_entry.h" 9 #include "content/public/browser/navigation_entry.h"
10 #include "content/public/browser/notification_service.h" 10 #include "content/public/browser/notification_service.h"
11 #include "content/public/browser/notification_types.h" 11 #include "content/public/browser/notification_types.h"
12 #include "testing/gmock/include/gmock/gmock.h" 12 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 namespace { 15 namespace {
16 16
17 class MockSearchMetrics : public GoogleSearchMetrics { 17 class MockSearchMetrics : public GoogleSearchMetrics {
18 public: 18 public:
19 MOCK_CONST_METHOD1(RecordGoogleSearch, 19 MOCK_CONST_METHOD1(RecordGoogleSearch,
20 void(GoogleSearchMetrics::AccessPoint ap)); 20 void(GoogleSearchMetrics::AccessPoint ap));
21 }; 21 };
22 22
23 } // namespace 23 } // namespace
24 24
25 class GoogleSearchCounterTest : public testing::Test { 25 class GoogleSearchCounterTest : public testing::Test {
26 protected: 26 protected:
27 GoogleSearchCounterTest(); 27 GoogleSearchCounterTest();
28 virtual ~GoogleSearchCounterTest(); 28 ~GoogleSearchCounterTest() override;
29 29
30 // testing::Test 30 // testing::Test
31 virtual void SetUp(); 31 void SetUp() override;
32 virtual void TearDown(); 32 void TearDown() override;
33 33
34 // Test if |url| is a Google search for specific types. When |is_omnibox| is 34 // Test if |url| is a Google search for specific types. When |is_omnibox| is
35 // true, this method will append Omnibox identifiers to the simulated URL 35 // true, this method will append Omnibox identifiers to the simulated URL
36 // navigation. If |expected_metric| is set and not AP_BOUNDARY, we'll also use 36 // navigation. If |expected_metric| is set and not AP_BOUNDARY, we'll also use
37 // the Search Metrics mock class to ensure that the type of metric recorded is 37 // the Search Metrics mock class to ensure that the type of metric recorded is
38 // correct. Note that when |expected_metric| is AP_BOUNDARY, we strictly 38 // correct. Note that when |expected_metric| is AP_BOUNDARY, we strictly
39 // forbid any metrics from being logged at all. See implementation below for 39 // forbid any metrics from being logged at all. See implementation below for
40 // details. 40 // details.
41 void TestGoogleSearch(const std::string& url, 41 void TestGoogleSearch(const std::string& url,
42 bool is_omnibox, 42 bool is_omnibox,
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 TEST_F(GoogleSearchCounterTest, SearchAppStart) { 140 TEST_F(GoogleSearchCounterTest, SearchAppStart) {
141 // Starting the search app takes you to this URL, but it should not be 141 // Starting the search app takes you to this URL, but it should not be
142 // considered an actual search event. Note that this URL is not considered an 142 // considered an actual search event. Note that this URL is not considered an
143 // actual search because it has no query string parameter ("q"). 143 // actual search because it has no query string parameter ("q").
144 TestGoogleSearch("http://www.google.com/webhp?source=search_app", 144 TestGoogleSearch("http://www.google.com/webhp?source=search_app",
145 false, GoogleSearchMetrics::AP_BOUNDARY); 145 false, GoogleSearchMetrics::AP_BOUNDARY);
146 } 146 }
147 147
148 // TODO(stevet): Add a regression test to protect against the particular 148 // TODO(stevet): Add a regression test to protect against the particular
149 // bad-flags handling case that asvitkine pointed out. 149 // bad-flags handling case that asvitkine pointed out.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698