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

Side by Side Diff: components/google/core/browser/google_url_tracker_unittest.cc

Issue 812823002: Remove dependency of infobars component on the embedder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on Android Created 6 years 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 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"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/prefs/pref_registry_simple.h" 12 #include "base/prefs/pref_registry_simple.h"
13 #include "base/prefs/pref_service.h" 13 #include "base/prefs/pref_service.h"
14 #include "base/prefs/testing_pref_service.h" 14 #include "base/prefs/testing_pref_service.h"
15 #include "components/google/core/browser/google_pref_names.h" 15 #include "components/google/core/browser/google_pref_names.h"
16 #include "components/google/core/browser/google_url_tracker_client.h" 16 #include "components/google/core/browser/google_url_tracker_client.h"
17 #include "components/google/core/browser/google_url_tracker_infobar_delegate.h" 17 #include "components/google/core/browser/google_url_tracker_infobar_delegate.h"
18 #include "components/google/core/browser/google_url_tracker_navigation_helper.h" 18 #include "components/google/core/browser/google_url_tracker_navigation_helper.h"
19 #include "components/infobars/core/confirm_infobar_delegate.h"
19 #include "components/infobars/core/infobar.h" 20 #include "components/infobars/core/infobar.h"
20 #include "components/infobars/core/infobar_delegate.h" 21 #include "components/infobars/core/infobar_delegate.h"
21 #include "net/url_request/test_url_fetcher_factory.h" 22 #include "net/url_request/test_url_fetcher_factory.h"
22 #include "net/url_request/url_fetcher.h" 23 #include "net/url_request/url_fetcher.h"
23 #include "net/url_request/url_request_test_util.h" 24 #include "net/url_request/url_request_test_util.h"
24 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
25 26
26 namespace { 27 namespace {
27 28
28 // TestCallbackListener --------------------------------------------------- 29 // TestCallbackListener ---------------------------------------------------
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 179
179 // TestInfoBarManager --------------------------------------------------------- 180 // TestInfoBarManager ---------------------------------------------------------
180 181
181 class TestInfoBarManager : public infobars::InfoBarManager { 182 class TestInfoBarManager : public infobars::InfoBarManager {
182 public: 183 public:
183 explicit TestInfoBarManager(int unique_id); 184 explicit TestInfoBarManager(int unique_id);
184 ~TestInfoBarManager() override; 185 ~TestInfoBarManager() override;
185 int GetActiveEntryID() override; 186 int GetActiveEntryID() override;
186 187
187 private: 188 private:
189 // infobars::InfoBarManager:
190 scoped_ptr<infobars::InfoBar> CreateConfirmInfoBar(
191 scoped_ptr<ConfirmInfoBarDelegate> delegate) override;
192
188 int unique_id_; 193 int unique_id_;
189 DISALLOW_COPY_AND_ASSIGN(TestInfoBarManager); 194 DISALLOW_COPY_AND_ASSIGN(TestInfoBarManager);
190 }; 195 };
191 196
192 TestInfoBarManager::TestInfoBarManager(int unique_id) : unique_id_(unique_id) { 197 TestInfoBarManager::TestInfoBarManager(int unique_id) : unique_id_(unique_id) {
193 } 198 }
194 199
195 TestInfoBarManager::~TestInfoBarManager() { 200 TestInfoBarManager::~TestInfoBarManager() {
196 ShutDown(); 201 ShutDown();
197 } 202 }
198 203
199 int TestInfoBarManager::GetActiveEntryID() { 204 int TestInfoBarManager::GetActiveEntryID() {
200 return unique_id_; 205 return unique_id_;
201 } 206 }
202 207
208 scoped_ptr<infobars::InfoBar> TestInfoBarManager::CreateConfirmInfoBar(
209 scoped_ptr<ConfirmInfoBarDelegate> delegate) {
210 return make_scoped_ptr(new infobars::InfoBar(delegate.Pass()));
211 }
212
203 } // namespace 213 } // namespace
204 214
205 // GoogleURLTrackerTest ------------------------------------------------------- 215 // GoogleURLTrackerTest -------------------------------------------------------
206 216
207 class GoogleURLTrackerTest : public testing::Test { 217 class GoogleURLTrackerTest : public testing::Test {
208 protected: 218 protected:
209 GoogleURLTrackerTest(); 219 GoogleURLTrackerTest();
210 ~GoogleURLTrackerTest() override; 220 ~GoogleURLTrackerTest() override;
211 221
212 // testing::Test 222 // testing::Test
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 EXPECT_FALSE(GetInfoBarDelegate(&infobar_manager) == NULL); 1054 EXPECT_FALSE(GetInfoBarDelegate(&infobar_manager) == NULL);
1045 GoogleURLTrackerInfoBarDelegate* delegate2 = 1055 GoogleURLTrackerInfoBarDelegate* delegate2 =
1046 GetInfoBarDelegate(&infobar_manager2); 1056 GetInfoBarDelegate(&infobar_manager2);
1047 ASSERT_FALSE(delegate2 == NULL); 1057 ASSERT_FALSE(delegate2 == NULL);
1048 SetNavigationPending(&infobar_manager, true); 1058 SetNavigationPending(&infobar_manager, true);
1049 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(&infobar_manager, true)); 1059 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(&infobar_manager, true));
1050 delegate2->Close(false); 1060 delegate2->Close(false);
1051 SetNavigationPending(&infobar_manager, false); 1061 SetNavigationPending(&infobar_manager, false);
1052 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(&infobar_manager, false)); 1062 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(&infobar_manager, false));
1053 } 1063 }
OLDNEW
« no previous file with comments | « components/google/core/browser/google_url_tracker_infobar_delegate.cc ('k') | components/infobars.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698