OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/google/core/browser/google_url_tracker.h" | 5 #include "components/google/core/browser/google_url_tracker.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 google_url_tracker->RegisterCallback(base::Bind( | 65 google_url_tracker->RegisterCallback(base::Bind( |
66 &TestCallbackListener::OnGoogleURLUpdated, base::Unretained(this))); | 66 &TestCallbackListener::OnGoogleURLUpdated, base::Unretained(this))); |
67 } | 67 } |
68 | 68 |
69 | 69 |
70 // TestGoogleURLTrackerClient ------------------------------------------------- | 70 // TestGoogleURLTrackerClient ------------------------------------------------- |
71 | 71 |
72 class TestGoogleURLTrackerClient : public GoogleURLTrackerClient { | 72 class TestGoogleURLTrackerClient : public GoogleURLTrackerClient { |
73 public: | 73 public: |
74 explicit TestGoogleURLTrackerClient(PrefService* prefs_); | 74 explicit TestGoogleURLTrackerClient(PrefService* prefs_); |
75 virtual ~TestGoogleURLTrackerClient(); | 75 ~TestGoogleURLTrackerClient() override; |
76 | 76 |
77 virtual void SetListeningForNavigationStart(bool listen) override; | 77 void SetListeningForNavigationStart(bool listen) override; |
78 virtual bool IsListeningForNavigationStart() override; | 78 bool IsListeningForNavigationStart() override; |
79 virtual bool IsBackgroundNetworkingEnabled() override; | 79 bool IsBackgroundNetworkingEnabled() override; |
80 virtual PrefService* GetPrefs() override; | 80 PrefService* GetPrefs() override; |
81 virtual net::URLRequestContextGetter* GetRequestContext() override; | 81 net::URLRequestContextGetter* GetRequestContext() override; |
82 | 82 |
83 private: | 83 private: |
84 PrefService* prefs_; | 84 PrefService* prefs_; |
85 scoped_refptr<net::TestURLRequestContextGetter> request_context_; | 85 scoped_refptr<net::TestURLRequestContextGetter> request_context_; |
86 bool observe_nav_start_; | 86 bool observe_nav_start_; |
87 | 87 |
88 DISALLOW_COPY_AND_ASSIGN(TestGoogleURLTrackerClient); | 88 DISALLOW_COPY_AND_ASSIGN(TestGoogleURLTrackerClient); |
89 }; | 89 }; |
90 | 90 |
91 TestGoogleURLTrackerClient::TestGoogleURLTrackerClient(PrefService* prefs) | 91 TestGoogleURLTrackerClient::TestGoogleURLTrackerClient(PrefService* prefs) |
(...skipping 26 matching lines...) Expand all Loading... |
118 return request_context_.get(); | 118 return request_context_.get(); |
119 } | 119 } |
120 | 120 |
121 | 121 |
122 // TestGoogleURLTrackerNavigationHelper --------------------------------------- | 122 // TestGoogleURLTrackerNavigationHelper --------------------------------------- |
123 | 123 |
124 class TestGoogleURLTrackerNavigationHelper | 124 class TestGoogleURLTrackerNavigationHelper |
125 : public GoogleURLTrackerNavigationHelper { | 125 : public GoogleURLTrackerNavigationHelper { |
126 public: | 126 public: |
127 explicit TestGoogleURLTrackerNavigationHelper(GoogleURLTracker* tracker); | 127 explicit TestGoogleURLTrackerNavigationHelper(GoogleURLTracker* tracker); |
128 virtual ~TestGoogleURLTrackerNavigationHelper(); | 128 ~TestGoogleURLTrackerNavigationHelper() override; |
129 | 129 |
130 virtual void SetListeningForNavigationCommit(bool listen) override; | 130 void SetListeningForNavigationCommit(bool listen) override; |
131 virtual bool IsListeningForNavigationCommit() override; | 131 bool IsListeningForNavigationCommit() override; |
132 virtual void SetListeningForTabDestruction(bool listen) override; | 132 void SetListeningForTabDestruction(bool listen) override; |
133 virtual bool IsListeningForTabDestruction() override; | 133 bool IsListeningForTabDestruction() override; |
134 virtual void OpenURL(GURL url, | 134 void OpenURL(GURL url, |
135 WindowOpenDisposition disposition, | 135 WindowOpenDisposition disposition, |
136 bool user_clicked_on_link) override; | 136 bool user_clicked_on_link) override; |
137 | 137 |
138 private: | 138 private: |
139 bool listening_for_nav_commit_; | 139 bool listening_for_nav_commit_; |
140 bool listening_for_tab_destruction_; | 140 bool listening_for_tab_destruction_; |
141 | 141 |
142 DISALLOW_COPY_AND_ASSIGN(TestGoogleURLTrackerNavigationHelper); | 142 DISALLOW_COPY_AND_ASSIGN(TestGoogleURLTrackerNavigationHelper); |
143 }; | 143 }; |
144 | 144 |
145 TestGoogleURLTrackerNavigationHelper::TestGoogleURLTrackerNavigationHelper( | 145 TestGoogleURLTrackerNavigationHelper::TestGoogleURLTrackerNavigationHelper( |
146 GoogleURLTracker* tracker) | 146 GoogleURLTracker* tracker) |
(...skipping 27 matching lines...) Expand all Loading... |
174 GURL url, | 174 GURL url, |
175 WindowOpenDisposition disposition, | 175 WindowOpenDisposition disposition, |
176 bool user_clicked_on_link) { | 176 bool user_clicked_on_link) { |
177 } | 177 } |
178 | 178 |
179 // TestInfoBarManager --------------------------------------------------------- | 179 // TestInfoBarManager --------------------------------------------------------- |
180 | 180 |
181 class TestInfoBarManager : public infobars::InfoBarManager { | 181 class TestInfoBarManager : public infobars::InfoBarManager { |
182 public: | 182 public: |
183 explicit TestInfoBarManager(int unique_id); | 183 explicit TestInfoBarManager(int unique_id); |
184 virtual ~TestInfoBarManager(); | 184 ~TestInfoBarManager() override; |
185 virtual int GetActiveEntryID() override; | 185 int GetActiveEntryID() override; |
186 | 186 |
187 private: | 187 private: |
188 int unique_id_; | 188 int unique_id_; |
189 DISALLOW_COPY_AND_ASSIGN(TestInfoBarManager); | 189 DISALLOW_COPY_AND_ASSIGN(TestInfoBarManager); |
190 }; | 190 }; |
191 | 191 |
192 TestInfoBarManager::TestInfoBarManager(int unique_id) : unique_id_(unique_id) { | 192 TestInfoBarManager::TestInfoBarManager(int unique_id) : unique_id_(unique_id) { |
193 } | 193 } |
194 | 194 |
195 TestInfoBarManager::~TestInfoBarManager() { | 195 TestInfoBarManager::~TestInfoBarManager() { |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 EXPECT_FALSE(GetInfoBarDelegate(&infobar_manager) == NULL); | 1044 EXPECT_FALSE(GetInfoBarDelegate(&infobar_manager) == NULL); |
1045 GoogleURLTrackerInfoBarDelegate* delegate2 = | 1045 GoogleURLTrackerInfoBarDelegate* delegate2 = |
1046 GetInfoBarDelegate(&infobar_manager2); | 1046 GetInfoBarDelegate(&infobar_manager2); |
1047 ASSERT_FALSE(delegate2 == NULL); | 1047 ASSERT_FALSE(delegate2 == NULL); |
1048 SetNavigationPending(&infobar_manager, true); | 1048 SetNavigationPending(&infobar_manager, true); |
1049 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(&infobar_manager, true)); | 1049 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(&infobar_manager, true)); |
1050 delegate2->Close(false); | 1050 delegate2->Close(false); |
1051 SetNavigationPending(&infobar_manager, false); | 1051 SetNavigationPending(&infobar_manager, false); |
1052 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(&infobar_manager, false)); | 1052 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(&infobar_manager, false)); |
1053 } | 1053 } |
OLD | NEW |