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

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

Issue 283413002: Turn GoogleURLTrackerNavigationHelper(Impl) into a per-tab object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to review Created 6 years, 7 months 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 | Annotate | Revision Log
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_url_tracker.h" 5 #include "chrome/browser/google/google_url_tracker.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 TestNotificationObserver::~TestNotificationObserver() { 87 TestNotificationObserver::~TestNotificationObserver() {
88 } 88 }
89 89
90 void TestNotificationObserver::Observe( 90 void TestNotificationObserver::Observe(
91 int type, 91 int type,
92 const content::NotificationSource& source, 92 const content::NotificationSource& source,
93 const content::NotificationDetails& details) { 93 const content::NotificationDetails& details) {
94 notified_ = true; 94 notified_ = true;
95 } 95 }
96 96
97
97 // TestGoogleURLTrackerClient ------------------------------------------------- 98 // TestGoogleURLTrackerClient -------------------------------------------------
98 99
99 class TestGoogleURLTrackerClient : public GoogleURLTrackerClient { 100 class TestGoogleURLTrackerClient : public GoogleURLTrackerClient {
100 public: 101 public:
101 TestGoogleURLTrackerClient(); 102 TestGoogleURLTrackerClient();
102 virtual ~TestGoogleURLTrackerClient(); 103 virtual ~TestGoogleURLTrackerClient();
103 104
104 virtual void SetListeningForNavigationStart(bool listen) OVERRIDE; 105 virtual void SetListeningForNavigationStart(bool listen) OVERRIDE;
105 virtual bool IsListeningForNavigationStart() OVERRIDE; 106 virtual bool IsListeningForNavigationStart() OVERRIDE;
106 107
(...skipping 11 matching lines...) Expand all
118 } 119 }
119 120
120 void TestGoogleURLTrackerClient::SetListeningForNavigationStart(bool listen) { 121 void TestGoogleURLTrackerClient::SetListeningForNavigationStart(bool listen) {
121 observe_nav_start_ = listen; 122 observe_nav_start_ = listen;
122 } 123 }
123 124
124 bool TestGoogleURLTrackerClient::IsListeningForNavigationStart() { 125 bool TestGoogleURLTrackerClient::IsListeningForNavigationStart() {
125 return observe_nav_start_; 126 return observe_nav_start_;
126 } 127 }
127 128
129
128 // TestGoogleURLTrackerNavigationHelper --------------------------------------- 130 // TestGoogleURLTrackerNavigationHelper ---------------------------------------
129 131
130 class TestGoogleURLTrackerNavigationHelper 132 class TestGoogleURLTrackerNavigationHelper
131 : public GoogleURLTrackerNavigationHelper { 133 : public GoogleURLTrackerNavigationHelper {
132 public: 134 public:
133 TestGoogleURLTrackerNavigationHelper(); 135 explicit TestGoogleURLTrackerNavigationHelper(GoogleURLTracker* tracker);
134 virtual ~TestGoogleURLTrackerNavigationHelper(); 136 virtual ~TestGoogleURLTrackerNavigationHelper();
135 137
136 virtual void SetGoogleURLTracker(GoogleURLTracker* tracker) OVERRIDE; 138 virtual void SetListeningForNavigationCommit(bool listen) OVERRIDE;
137 virtual void SetListeningForNavigationCommit( 139 virtual bool IsListeningForNavigationCommit() OVERRIDE;
138 const content::NavigationController* nav_controller, 140 virtual void SetListeningForTabDestruction(bool listen) OVERRIDE;
139 bool listen) OVERRIDE; 141 virtual bool IsListeningForTabDestruction() OVERRIDE;
140 virtual bool IsListeningForNavigationCommit(
141 const content::NavigationController* nav_controller) OVERRIDE;
142 virtual void SetListeningForTabDestruction(
143 const content::NavigationController* nav_controller,
144 bool listen) OVERRIDE;
145 virtual bool IsListeningForTabDestruction(
146 const content::NavigationController* nav_controller) OVERRIDE;
147 142
148 private: 143 private:
149 GoogleURLTracker* tracker_; 144 bool listening_for_nav_commit_;
150 std::set<const content::NavigationController*> 145 bool listening_for_tab_destruction_;
151 nav_controller_commit_listeners_; 146
152 std::set<const content::NavigationController*> 147 DISALLOW_COPY_AND_ASSIGN(TestGoogleURLTrackerNavigationHelper);
153 nav_controller_tab_close_listeners_;
154 }; 148 };
155 149
156 TestGoogleURLTrackerNavigationHelper::TestGoogleURLTrackerNavigationHelper() 150 TestGoogleURLTrackerNavigationHelper::TestGoogleURLTrackerNavigationHelper(
157 : tracker_(NULL) { 151 GoogleURLTracker* tracker)
152 : GoogleURLTrackerNavigationHelper(tracker),
153 listening_for_nav_commit_(false),
154 listening_for_tab_destruction_(false) {
158 } 155 }
159 156
160 TestGoogleURLTrackerNavigationHelper:: 157 TestGoogleURLTrackerNavigationHelper::~TestGoogleURLTrackerNavigationHelper() {
161 ~TestGoogleURLTrackerNavigationHelper() {
162 }
163
164 void TestGoogleURLTrackerNavigationHelper::SetGoogleURLTracker(
165 GoogleURLTracker* tracker) {
166 tracker_ = tracker;
167 } 158 }
168 159
169 void TestGoogleURLTrackerNavigationHelper::SetListeningForNavigationCommit( 160 void TestGoogleURLTrackerNavigationHelper::SetListeningForNavigationCommit(
170 const content::NavigationController* nav_controller,
171 bool listen) { 161 bool listen) {
172 if (listen) 162 listening_for_nav_commit_ = listen;
173 nav_controller_commit_listeners_.insert(nav_controller);
174 else
175 nav_controller_commit_listeners_.erase(nav_controller);
176 } 163 }
177 164
178 bool TestGoogleURLTrackerNavigationHelper::IsListeningForNavigationCommit( 165 bool TestGoogleURLTrackerNavigationHelper::IsListeningForNavigationCommit() {
179 const content::NavigationController* nav_controller) { 166 return listening_for_nav_commit_;
180 return nav_controller_commit_listeners_.count(nav_controller) > 0;
181 } 167 }
182 168
183 void TestGoogleURLTrackerNavigationHelper::SetListeningForTabDestruction( 169 void TestGoogleURLTrackerNavigationHelper::SetListeningForTabDestruction(
184 const content::NavigationController* nav_controller,
185 bool listen) { 170 bool listen) {
186 if (listen) 171 listening_for_tab_destruction_ = listen;
187 nav_controller_tab_close_listeners_.insert(nav_controller);
188 else
189 nav_controller_tab_close_listeners_.erase(nav_controller);
190 } 172 }
191 173
192 bool TestGoogleURLTrackerNavigationHelper::IsListeningForTabDestruction( 174 bool TestGoogleURLTrackerNavigationHelper::IsListeningForTabDestruction() {
193 const content::NavigationController* nav_controller) { 175 return listening_for_tab_destruction_;
194 return nav_controller_tab_close_listeners_.count(nav_controller) > 0;
195 } 176 }
196 177
197 } // namespace 178 } // namespace
198 179
199 180
200 // GoogleURLTrackerTest ------------------------------------------------------- 181 // GoogleURLTrackerTest -------------------------------------------------------
201 182
202 // Ths class exercises GoogleURLTracker. In order to avoid instantiating more 183 // Ths class exercises GoogleURLTracker. In order to avoid instantiating more
203 // of the Chrome infrastructure than necessary, the GoogleURLTracker functions 184 // of the Chrome infrastructure than necessary, the GoogleURLTracker functions
204 // are carefully written so that many of the functions which take 185 // are carefully written so that many of the functions which take
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 } 222 }
242 GURL google_url() const { return google_url_tracker_->google_url(); } 223 GURL google_url() const { return google_url_tracker_->google_url(); }
243 void SetLastPromptedGoogleURL(const GURL& url); 224 void SetLastPromptedGoogleURL(const GURL& url);
244 GURL GetLastPromptedGoogleURL(); 225 GURL GetLastPromptedGoogleURL();
245 void SetNavigationPending(intptr_t unique_id, bool is_search); 226 void SetNavigationPending(intptr_t unique_id, bool is_search);
246 void CommitNonSearch(intptr_t unique_id); 227 void CommitNonSearch(intptr_t unique_id);
247 void CommitSearch(intptr_t unique_id, const GURL& search_url); 228 void CommitSearch(intptr_t unique_id, const GURL& search_url);
248 void CloseTab(intptr_t unique_id); 229 void CloseTab(intptr_t unique_id);
249 GoogleURLTrackerMapEntry* GetMapEntry(intptr_t unique_id); 230 GoogleURLTrackerMapEntry* GetMapEntry(intptr_t unique_id);
250 GoogleURLTrackerInfoBarDelegate* GetInfoBarDelegate(intptr_t unique_id); 231 GoogleURLTrackerInfoBarDelegate* GetInfoBarDelegate(intptr_t unique_id);
232 GoogleURLTrackerNavigationHelper* GetNavigationHelper(intptr_t unique_id);
251 void ExpectDefaultURLs() const; 233 void ExpectDefaultURLs() const;
252 void ExpectListeningForCommit(intptr_t unique_id, bool listening); 234 void ExpectListeningForCommit(intptr_t unique_id, bool listening);
253 bool observer_notified() const { return observer_.notified(); } 235 bool observer_notified() const { return observer_.notified(); }
254 void clear_observer_notified() { observer_.clear_notified(); } 236 void clear_observer_notified() { observer_.clear_notified(); }
255 237
256 private: 238 private:
257 // Since |infobar_service| is really a magic number rather than an actual 239 // Since |infobar_service| is really a magic number rather than an actual
258 // object, we don't add the created infobar to it. Instead we will simulate 240 // object, we don't add the created infobar to it. Instead we will simulate
259 // any helper<->infobar interaction necessary. The returned object will be 241 // any helper<->infobar interaction necessary. The returned object will be
260 // cleaned up in OnInfoBarClosed(). 242 // cleaned up in OnInfoBarClosed().
261 infobars::InfoBar* CreateTestInfoBar(InfoBarService* infobar_service, 243 infobars::InfoBar* CreateTestInfoBar(InfoBarService* infobar_service,
262 GoogleURLTracker* google_url_tracker, 244 GoogleURLTracker* google_url_tracker,
263 const GURL& search_url); 245 const GURL& search_url);
264 246
265 // These are required by the TestURLFetchers GoogleURLTracker will create (see 247 // These are required by the TestURLFetchers GoogleURLTracker will create (see
266 // test_url_fetcher_factory.h). 248 // test_url_fetcher_factory.h).
267 content::TestBrowserThreadBundle thread_bundle_; 249 content::TestBrowserThreadBundle thread_bundle_;
268 // Creating this allows us to call 250 // Creating this allows us to call
269 // net::NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(). 251 // net::NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests().
270 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; 252 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
271 net::TestURLFetcherFactory fetcher_factory_; 253 net::TestURLFetcherFactory fetcher_factory_;
272 content::NotificationRegistrar registrar_; 254 content::NotificationRegistrar registrar_;
273 TestNotificationObserver observer_; 255 TestNotificationObserver observer_;
274 GoogleURLTrackerClient* client_; 256 GoogleURLTrackerClient* client_;
275 GoogleURLTrackerNavigationHelper* nav_helper_;
276 TestingProfile profile_; 257 TestingProfile profile_;
277 scoped_ptr<GoogleURLTracker> google_url_tracker_; 258 scoped_ptr<GoogleURLTracker> google_url_tracker_;
278 // This tracks the different "tabs" a test has "opened", so we can close them 259 // This tracks the different "tabs" a test has "opened", so we can close them
279 // properly before shutting down |google_url_tracker_|, which expects that. 260 // properly before shutting down |google_url_tracker_|, which expects that.
280 std::set<int> unique_ids_seen_; 261 std::set<int> unique_ids_seen_;
281 }; 262 };
282 263
283 void GoogleURLTrackerTest::OnInfoBarClosed( 264 void GoogleURLTrackerTest::OnInfoBarClosed(
284 scoped_ptr<infobars::InfoBar> infobar, 265 scoped_ptr<infobars::InfoBar> infobar,
285 InfoBarService* infobar_service) { 266 InfoBarService* infobar_service) {
(...skipping 17 matching lines...) Expand all
303 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { 284 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {
304 GoogleURLTrackerFactory::GetInstance()-> 285 GoogleURLTrackerFactory::GetInstance()->
305 RegisterUserPrefsOnBrowserContextForTest(&profile_); 286 RegisterUserPrefsOnBrowserContextForTest(&profile_);
306 } 287 }
307 288
308 GoogleURLTrackerTest::~GoogleURLTrackerTest() { 289 GoogleURLTrackerTest::~GoogleURLTrackerTest() {
309 } 290 }
310 291
311 void GoogleURLTrackerTest::SetUp() { 292 void GoogleURLTrackerTest::SetUp() {
312 network_change_notifier_.reset(net::NetworkChangeNotifier::CreateMock()); 293 network_change_notifier_.reset(net::NetworkChangeNotifier::CreateMock());
313 // Ownership is passed to google_url_tracker_, but weak pointers are kept; 294 // Ownership is passed to google_url_tracker_, but a weak pointer is kept;
314 // this is safe since GoogleURLTracker keeps these objects for its lifetime. 295 // this is safe since GoogleURLTracker keeps the client for its lifetime.
315 client_ = new TestGoogleURLTrackerClient(); 296 client_ = new TestGoogleURLTrackerClient();
316 nav_helper_ = new TestGoogleURLTrackerNavigationHelper();
317 scoped_ptr<GoogleURLTrackerClient> client(client_); 297 scoped_ptr<GoogleURLTrackerClient> client(client_);
318 scoped_ptr<GoogleURLTrackerNavigationHelper> nav_helper(nav_helper_); 298 google_url_tracker_.reset(new GoogleURLTracker(
319 google_url_tracker_.reset( 299 &profile_, client.Pass(), GoogleURLTracker::UNIT_TEST_MODE));
320 new GoogleURLTracker(&profile_,
321 client.Pass(),
322 nav_helper.Pass(),
323 GoogleURLTracker::UNIT_TEST_MODE));
324 google_url_tracker_->infobar_creator_ = base::Bind( 300 google_url_tracker_->infobar_creator_ = base::Bind(
325 &GoogleURLTrackerTest::CreateTestInfoBar, base::Unretained(this)); 301 &GoogleURLTrackerTest::CreateTestInfoBar, base::Unretained(this));
326 } 302 }
327 303
328 void GoogleURLTrackerTest::TearDown() { 304 void GoogleURLTrackerTest::TearDown() {
329 while (!unique_ids_seen_.empty()) 305 while (!unique_ids_seen_.empty())
330 CloseTab(*unique_ids_seen_.begin()); 306 CloseTab(*unique_ids_seen_.begin());
331 } 307 }
332 308
333 net::TestURLFetcher* GoogleURLTrackerTest::GetFetcher() { 309 net::TestURLFetcher* GoogleURLTrackerTest::GetFetcher() {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 void GoogleURLTrackerTest::SetNavigationPending(intptr_t unique_id, 357 void GoogleURLTrackerTest::SetNavigationPending(intptr_t unique_id,
382 bool is_search) { 358 bool is_search) {
383 if (is_search) { 359 if (is_search) {
384 google_url_tracker_->SearchCommitted(); 360 google_url_tracker_->SearchCommitted();
385 // Note that the call above might not have actually registered a listener 361 // Note that the call above might not have actually registered a listener
386 // for navigation starts if the searchdomaincheck response was bogus. 362 // for navigation starts if the searchdomaincheck response was bogus.
387 } 363 }
388 unique_ids_seen_.insert(unique_id); 364 unique_ids_seen_.insert(unique_id);
389 if (client_->IsListeningForNavigationStart()) { 365 if (client_->IsListeningForNavigationStart()) {
390 google_url_tracker_->OnNavigationPending( 366 google_url_tracker_->OnNavigationPending(
391 reinterpret_cast<content::NavigationController*>(unique_id), 367 scoped_ptr<GoogleURLTrackerNavigationHelper>(
392 reinterpret_cast<InfoBarService*>(unique_id), unique_id); 368 new TestGoogleURLTrackerNavigationHelper(
369 google_url_tracker_.get())),
370 reinterpret_cast<InfoBarService*>(unique_id),
371 unique_id);
393 } 372 }
394 } 373 }
395 374
396 void GoogleURLTrackerTest::CommitNonSearch(intptr_t unique_id) { 375 void GoogleURLTrackerTest::CommitNonSearch(intptr_t unique_id) {
397 GoogleURLTrackerMapEntry* map_entry = GetMapEntry(unique_id); 376 GoogleURLTrackerMapEntry* map_entry = GetMapEntry(unique_id);
398 if (!map_entry) 377 if (!map_entry)
399 return; 378 return;
400 379
401 ExpectListeningForCommit(unique_id, false); 380 ExpectListeningForCommit(unique_id, false);
402 381
403 // The infobar should be showing; otherwise the pending non-search should 382 // The infobar should be showing; otherwise the pending non-search should
404 // have closed it. 383 // have closed it.
405 ASSERT_TRUE(map_entry->has_infobar_delegate()); 384 ASSERT_TRUE(map_entry->has_infobar_delegate());
406 385
407 // The pending_id should have been reset to 0 when the non-search became 386 // The pending_id should have been reset to 0 when the non-search became
408 // pending. 387 // pending.
409 EXPECT_EQ(0, map_entry->infobar_delegate()->pending_id()); 388 EXPECT_EQ(0, map_entry->infobar_delegate()->pending_id());
410 389
411 // Committing the navigation would close the infobar. 390 // Committing the navigation would close the infobar.
412 map_entry->infobar_delegate()->Close(false); 391 map_entry->infobar_delegate()->Close(false);
413 } 392 }
414 393
415 void GoogleURLTrackerTest::CommitSearch(intptr_t unique_id, 394 void GoogleURLTrackerTest::CommitSearch(intptr_t unique_id,
416 const GURL& search_url) { 395 const GURL& search_url) {
417 DCHECK(search_url.is_valid()); 396 DCHECK(search_url.is_valid());
418 if (nav_helper_->IsListeningForNavigationCommit( 397 GoogleURLTrackerNavigationHelper* nav_helper = GetNavigationHelper(unique_id);
419 reinterpret_cast<content::NavigationController*>(unique_id))) { 398 if (nav_helper && nav_helper->IsListeningForNavigationCommit()) {
420 google_url_tracker_->OnNavigationCommitted( 399 google_url_tracker_->OnNavigationCommitted(
421 reinterpret_cast<InfoBarService*>(unique_id), search_url); 400 reinterpret_cast<InfoBarService*>(unique_id), search_url);
422 } 401 }
423 } 402 }
424 403
425 void GoogleURLTrackerTest::CloseTab(intptr_t unique_id) { 404 void GoogleURLTrackerTest::CloseTab(intptr_t unique_id) {
426 unique_ids_seen_.erase(unique_id); 405 unique_ids_seen_.erase(unique_id);
427 content::NavigationController* nav_controller = 406 GoogleURLTrackerNavigationHelper* nav_helper = GetNavigationHelper(unique_id);
428 reinterpret_cast<content::NavigationController*>(unique_id); 407 if (nav_helper && nav_helper->IsListeningForTabDestruction()) {
429 if (nav_helper_->IsListeningForTabDestruction(nav_controller)) { 408 google_url_tracker_->OnTabClosed(nav_helper);
430 google_url_tracker_->OnTabClosed(nav_controller);
431 } else { 409 } else {
432 // Closing a tab with an infobar showing would close the infobar. 410 // Closing a tab with an infobar showing would close the infobar.
433 GoogleURLTrackerInfoBarDelegate* delegate = GetInfoBarDelegate(unique_id); 411 GoogleURLTrackerInfoBarDelegate* delegate = GetInfoBarDelegate(unique_id);
434 if (delegate) 412 if (delegate)
435 delegate->Close(false); 413 delegate->Close(false);
436 } 414 }
437 } 415 }
438 416
439 GoogleURLTrackerMapEntry* GoogleURLTrackerTest::GetMapEntry( 417 GoogleURLTrackerMapEntry* GoogleURLTrackerTest::GetMapEntry(
440 intptr_t unique_id) { 418 intptr_t unique_id) {
441 GoogleURLTracker::EntryMap::const_iterator i = 419 GoogleURLTracker::EntryMap::const_iterator i =
442 google_url_tracker_->entry_map_.find( 420 google_url_tracker_->entry_map_.find(
443 reinterpret_cast<InfoBarService*>(unique_id)); 421 reinterpret_cast<InfoBarService*>(unique_id));
444 return (i == google_url_tracker_->entry_map_.end()) ? NULL : i->second; 422 return (i == google_url_tracker_->entry_map_.end()) ? NULL : i->second;
445 } 423 }
446 424
447 GoogleURLTrackerInfoBarDelegate* GoogleURLTrackerTest::GetInfoBarDelegate( 425 GoogleURLTrackerInfoBarDelegate* GoogleURLTrackerTest::GetInfoBarDelegate(
448 intptr_t unique_id) { 426 intptr_t unique_id) {
449 GoogleURLTrackerMapEntry* map_entry = GetMapEntry(unique_id); 427 GoogleURLTrackerMapEntry* map_entry = GetMapEntry(unique_id);
450 return map_entry ? map_entry->infobar_delegate() : NULL; 428 return map_entry ? map_entry->infobar_delegate() : NULL;
451 } 429 }
452 430
431 GoogleURLTrackerNavigationHelper* GoogleURLTrackerTest::GetNavigationHelper(
432 intptr_t unique_id) {
433 GoogleURLTrackerMapEntry* map_entry = GetMapEntry(unique_id);
434 return map_entry ? map_entry->navigation_helper() : NULL;
435 }
436
453 void GoogleURLTrackerTest::ExpectDefaultURLs() const { 437 void GoogleURLTrackerTest::ExpectDefaultURLs() const {
454 EXPECT_EQ(GURL(GoogleURLTracker::kDefaultGoogleHomepage), google_url()); 438 EXPECT_EQ(GURL(GoogleURLTracker::kDefaultGoogleHomepage), google_url());
455 EXPECT_EQ(GURL(), fetched_google_url()); 439 EXPECT_EQ(GURL(), fetched_google_url());
456 } 440 }
457 441
458 void GoogleURLTrackerTest::ExpectListeningForCommit(intptr_t unique_id, 442 void GoogleURLTrackerTest::ExpectListeningForCommit(intptr_t unique_id,
459 bool listening) { 443 bool listening) {
460 GoogleURLTrackerMapEntry* map_entry = GetMapEntry(unique_id); 444 GoogleURLTrackerMapEntry* map_entry = GetMapEntry(unique_id);
461 if (map_entry) { 445 if (map_entry) {
462 EXPECT_EQ(listening, nav_helper_->IsListeningForNavigationCommit( 446 EXPECT_EQ(listening,
463 map_entry->navigation_controller())); 447 map_entry->navigation_helper()->IsListeningForNavigationCommit());
464 } else { 448 } else {
465 EXPECT_FALSE(listening); 449 EXPECT_FALSE(listening);
466 } 450 }
467 } 451 }
468 452
469 infobars::InfoBar* GoogleURLTrackerTest::CreateTestInfoBar( 453 infobars::InfoBar* GoogleURLTrackerTest::CreateTestInfoBar(
470 InfoBarService* infobar_service, 454 InfoBarService* infobar_service,
471 GoogleURLTracker* google_url_tracker, 455 GoogleURLTracker* google_url_tracker,
472 const GURL& search_url) { 456 const GURL& search_url) {
473 return TestInfoBarDelegate::Create(this, infobar_service, google_url_tracker, 457 return TestInfoBarDelegate::Create(this, infobar_service, google_url_tracker,
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 CommitSearch(2, GURL("http://www.google.co.uk/search?q=test2")); 1080 CommitSearch(2, GURL("http://www.google.co.uk/search?q=test2"));
1097 EXPECT_FALSE(GetInfoBarDelegate(1) == NULL); 1081 EXPECT_FALSE(GetInfoBarDelegate(1) == NULL);
1098 GoogleURLTrackerInfoBarDelegate* delegate2 = GetInfoBarDelegate(2); 1082 GoogleURLTrackerInfoBarDelegate* delegate2 = GetInfoBarDelegate(2);
1099 ASSERT_FALSE(delegate2 == NULL); 1083 ASSERT_FALSE(delegate2 == NULL);
1100 SetNavigationPending(1, true); 1084 SetNavigationPending(1, true);
1101 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(1, true)); 1085 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(1, true));
1102 delegate2->Close(false); 1086 delegate2->Close(false);
1103 SetNavigationPending(1, false); 1087 SetNavigationPending(1, false);
1104 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(1, false)); 1088 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(1, false));
1105 } 1089 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698