OLD | NEW |
---|---|
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 } | 130 } |
131 | 131 |
132 void TestGoogleURLTrackerClient::SetListeningForNavigationStart(bool listen) { | 132 void TestGoogleURLTrackerClient::SetListeningForNavigationStart(bool listen) { |
133 observe_nav_start_ = listen; | 133 observe_nav_start_ = listen; |
134 } | 134 } |
135 | 135 |
136 bool TestGoogleURLTrackerClient::IsListeningForNavigationStart() { | 136 bool TestGoogleURLTrackerClient::IsListeningForNavigationStart() { |
137 return observe_nav_start_; | 137 return observe_nav_start_; |
138 } | 138 } |
139 | 139 |
140 | |
140 // TestGoogleURLTrackerNavigationHelper --------------------------------------- | 141 // TestGoogleURLTrackerNavigationHelper --------------------------------------- |
141 | 142 |
142 class TestGoogleURLTrackerNavigationHelper | 143 class TestGoogleURLTrackerNavigationHelper |
143 : public GoogleURLTrackerNavigationHelper { | 144 : public GoogleURLTrackerNavigationHelper { |
144 public: | 145 public: |
145 TestGoogleURLTrackerNavigationHelper(); | 146 explicit TestGoogleURLTrackerNavigationHelper(GoogleURLTracker* tracker); |
146 virtual ~TestGoogleURLTrackerNavigationHelper(); | 147 virtual ~TestGoogleURLTrackerNavigationHelper(); |
147 | 148 |
148 virtual void SetGoogleURLTracker(GoogleURLTracker* tracker) OVERRIDE; | 149 virtual void SetListeningForNavigationCommit(bool listen) OVERRIDE; |
149 virtual void SetListeningForNavigationCommit( | 150 virtual bool IsListeningForNavigationCommit() OVERRIDE; |
150 const content::NavigationController* nav_controller, | 151 virtual void SetListeningForTabDestruction(bool listen) OVERRIDE; |
151 bool listen) OVERRIDE; | 152 virtual bool IsListeningForTabDestruction() OVERRIDE; |
152 virtual bool IsListeningForNavigationCommit( | |
153 const content::NavigationController* nav_controller) OVERRIDE; | |
154 virtual void SetListeningForTabDestruction( | |
155 const content::NavigationController* nav_controller, | |
156 bool listen) OVERRIDE; | |
157 virtual bool IsListeningForTabDestruction( | |
158 const content::NavigationController* nav_controller) OVERRIDE; | |
159 | 153 |
160 private: | 154 private: |
161 GoogleURLTracker* tracker_; | 155 bool listening_for_nav_commit_; |
162 std::set<const content::NavigationController*> | 156 bool listening_for_tab_destruction_; |
163 nav_controller_commit_listeners_; | 157 |
164 std::set<const content::NavigationController*> | 158 DISALLOW_COPY_AND_ASSIGN(TestGoogleURLTrackerNavigationHelper); |
165 nav_controller_tab_close_listeners_; | |
166 }; | 159 }; |
167 | 160 |
168 TestGoogleURLTrackerNavigationHelper::TestGoogleURLTrackerNavigationHelper() | 161 TestGoogleURLTrackerNavigationHelper::TestGoogleURLTrackerNavigationHelper( |
169 : tracker_(NULL) { | 162 GoogleURLTracker* tracker) |
163 : GoogleURLTrackerNavigationHelper(tracker), | |
164 listening_for_nav_commit_(false), | |
165 listening_for_tab_destruction_(false) { | |
170 } | 166 } |
171 | 167 |
172 TestGoogleURLTrackerNavigationHelper:: | 168 TestGoogleURLTrackerNavigationHelper::~TestGoogleURLTrackerNavigationHelper() { |
173 ~TestGoogleURLTrackerNavigationHelper() { | |
174 } | |
175 | |
176 void TestGoogleURLTrackerNavigationHelper::SetGoogleURLTracker( | |
177 GoogleURLTracker* tracker) { | |
178 tracker_ = tracker; | |
179 } | 169 } |
180 | 170 |
181 void TestGoogleURLTrackerNavigationHelper::SetListeningForNavigationCommit( | 171 void TestGoogleURLTrackerNavigationHelper::SetListeningForNavigationCommit( |
182 const content::NavigationController* nav_controller, | |
183 bool listen) { | 172 bool listen) { |
184 if (listen) | 173 listening_for_nav_commit_ = listen; |
185 nav_controller_commit_listeners_.insert(nav_controller); | |
186 else | |
187 nav_controller_commit_listeners_.erase(nav_controller); | |
188 } | 174 } |
189 | 175 |
190 bool TestGoogleURLTrackerNavigationHelper::IsListeningForNavigationCommit( | 176 bool TestGoogleURLTrackerNavigationHelper::IsListeningForNavigationCommit() { |
191 const content::NavigationController* nav_controller) { | 177 return listening_for_nav_commit_; |
192 return nav_controller_commit_listeners_.count(nav_controller) > 0; | |
193 } | 178 } |
194 | 179 |
195 void TestGoogleURLTrackerNavigationHelper::SetListeningForTabDestruction( | 180 void TestGoogleURLTrackerNavigationHelper::SetListeningForTabDestruction( |
196 const content::NavigationController* nav_controller, | |
197 bool listen) { | 181 bool listen) { |
198 if (listen) | 182 listening_for_tab_destruction_ = listen; |
199 nav_controller_tab_close_listeners_.insert(nav_controller); | |
200 else | |
201 nav_controller_tab_close_listeners_.erase(nav_controller); | |
202 } | 183 } |
203 | 184 |
204 bool TestGoogleURLTrackerNavigationHelper::IsListeningForTabDestruction( | 185 bool TestGoogleURLTrackerNavigationHelper::IsListeningForTabDestruction() { |
205 const content::NavigationController* nav_controller) { | 186 return listening_for_tab_destruction_; |
206 return nav_controller_tab_close_listeners_.count(nav_controller) > 0; | |
207 } | 187 } |
208 | 188 |
209 } // namespace | 189 } // namespace |
210 | 190 |
211 | 191 |
212 // GoogleURLTrackerTest ------------------------------------------------------- | 192 // GoogleURLTrackerTest ------------------------------------------------------- |
213 | 193 |
214 // Ths class exercises GoogleURLTracker. In order to avoid instantiating more | 194 // Ths class exercises GoogleURLTracker. In order to avoid instantiating more |
215 // of the Chrome infrastructure than necessary, the GoogleURLTracker functions | 195 // of the Chrome infrastructure than necessary, the GoogleURLTracker functions |
216 // are carefully written so that many of the functions which take | 196 // are carefully written so that many of the functions which take |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
253 } | 233 } |
254 GURL google_url() const { return google_url_tracker_->google_url(); } | 234 GURL google_url() const { return google_url_tracker_->google_url(); } |
255 void SetLastPromptedGoogleURL(const GURL& url); | 235 void SetLastPromptedGoogleURL(const GURL& url); |
256 GURL GetLastPromptedGoogleURL(); | 236 GURL GetLastPromptedGoogleURL(); |
257 void SetNavigationPending(intptr_t unique_id, bool is_search); | 237 void SetNavigationPending(intptr_t unique_id, bool is_search); |
258 void CommitNonSearch(intptr_t unique_id); | 238 void CommitNonSearch(intptr_t unique_id); |
259 void CommitSearch(intptr_t unique_id, const GURL& search_url); | 239 void CommitSearch(intptr_t unique_id, const GURL& search_url); |
260 void CloseTab(intptr_t unique_id); | 240 void CloseTab(intptr_t unique_id); |
261 GoogleURLTrackerMapEntry* GetMapEntry(intptr_t unique_id); | 241 GoogleURLTrackerMapEntry* GetMapEntry(intptr_t unique_id); |
262 GoogleURLTrackerInfoBarDelegate* GetInfoBarDelegate(intptr_t unique_id); | 242 GoogleURLTrackerInfoBarDelegate* GetInfoBarDelegate(intptr_t unique_id); |
243 GoogleURLTrackerNavigationHelper* GetNavigationHelper(intptr_t unique_id); | |
263 void ExpectDefaultURLs() const; | 244 void ExpectDefaultURLs() const; |
264 void ExpectListeningForCommit(intptr_t unique_id, bool listening); | 245 void ExpectListeningForCommit(intptr_t unique_id, bool listening); |
265 bool listener_notified() const { return listener_.notified(); } | 246 bool listener_notified() const { return listener_.notified(); } |
266 void clear_listener_notified() { listener_.clear_notified(); } | 247 void clear_listener_notified() { listener_.clear_notified(); } |
267 | 248 |
268 private: | 249 private: |
269 // Since |infobar_service| is really a magic number rather than an actual | 250 // Since |infobar_service| is really a magic number rather than an actual |
270 // object, we don't add the created infobar to it. Instead we will simulate | 251 // object, we don't add the created infobar to it. Instead we will simulate |
271 // any helper<->infobar interaction necessary. The returned object will be | 252 // any helper<->infobar interaction necessary. The returned object will be |
272 // cleaned up in OnInfoBarClosed(). | 253 // cleaned up in OnInfoBarClosed(). |
273 infobars::InfoBar* CreateTestInfoBar(InfoBarService* infobar_service, | 254 infobars::InfoBar* CreateTestInfoBar(InfoBarService* infobar_service, |
274 GoogleURLTracker* google_url_tracker, | 255 GoogleURLTracker* google_url_tracker, |
275 const GURL& search_url); | 256 const GURL& search_url); |
276 | 257 |
277 // These are required by the TestURLFetchers GoogleURLTracker will create (see | 258 // These are required by the TestURLFetchers GoogleURLTracker will create (see |
278 // test_url_fetcher_factory.h). | 259 // test_url_fetcher_factory.h). |
279 content::TestBrowserThreadBundle thread_bundle_; | 260 content::TestBrowserThreadBundle thread_bundle_; |
280 // Creating this allows us to call | 261 // Creating this allows us to call |
281 // net::NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(). | 262 // net::NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(). |
282 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; | 263 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; |
283 net::TestURLFetcherFactory fetcher_factory_; | 264 net::TestURLFetcherFactory fetcher_factory_; |
284 GoogleURLTrackerClient* client_; | 265 GoogleURLTrackerClient* client_; |
285 GoogleURLTrackerNavigationHelper* nav_helper_; | |
286 TestingProfile profile_; | 266 TestingProfile profile_; |
287 scoped_ptr<GoogleURLTracker> google_url_tracker_; | 267 scoped_ptr<GoogleURLTracker> google_url_tracker_; |
288 TestCallbackListener listener_; | 268 TestCallbackListener listener_; |
289 // This tracks the different "tabs" a test has "opened", so we can close them | 269 // This tracks the different "tabs" a test has "opened", so we can close them |
290 // properly before shutting down |google_url_tracker_|, which expects that. | 270 // properly before shutting down |google_url_tracker_|, which expects that. |
291 std::set<int> unique_ids_seen_; | 271 std::set<int> unique_ids_seen_; |
292 }; | 272 }; |
293 | 273 |
294 void GoogleURLTrackerTest::OnInfoBarClosed( | 274 void GoogleURLTrackerTest::OnInfoBarClosed( |
295 scoped_ptr<infobars::InfoBar> infobar, | 275 scoped_ptr<infobars::InfoBar> infobar, |
(...skipping 18 matching lines...) Expand all Loading... | |
314 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { | 294 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { |
315 GoogleURLTrackerFactory::GetInstance()-> | 295 GoogleURLTrackerFactory::GetInstance()-> |
316 RegisterUserPrefsOnBrowserContextForTest(&profile_); | 296 RegisterUserPrefsOnBrowserContextForTest(&profile_); |
317 } | 297 } |
318 | 298 |
319 GoogleURLTrackerTest::~GoogleURLTrackerTest() { | 299 GoogleURLTrackerTest::~GoogleURLTrackerTest() { |
320 } | 300 } |
321 | 301 |
322 void GoogleURLTrackerTest::SetUp() { | 302 void GoogleURLTrackerTest::SetUp() { |
323 network_change_notifier_.reset(net::NetworkChangeNotifier::CreateMock()); | 303 network_change_notifier_.reset(net::NetworkChangeNotifier::CreateMock()); |
324 // Ownership is passed to google_url_tracker_, but weak pointers are kept; | 304 // Ownership is passed to google_url_tracker_, but a weak pointer is kept; |
325 // this is safe since GoogleURLTracker keeps these objects for its lifetime. | 305 // this is safe since GoogleURLTracker keeps the client for its lifetime. |
326 client_ = new TestGoogleURLTrackerClient(); | 306 client_ = new TestGoogleURLTrackerClient(); |
327 nav_helper_ = new TestGoogleURLTrackerNavigationHelper(); | |
328 scoped_ptr<GoogleURLTrackerClient> client(client_); | 307 scoped_ptr<GoogleURLTrackerClient> client(client_); |
329 scoped_ptr<GoogleURLTrackerNavigationHelper> nav_helper(nav_helper_); | 308 google_url_tracker_.reset(new GoogleURLTracker( |
330 google_url_tracker_.reset( | 309 &profile_, client.Pass(), GoogleURLTracker::UNIT_TEST_MODE)); |
331 new GoogleURLTracker(&profile_, | |
332 client.Pass(), | |
333 nav_helper.Pass(), | |
334 GoogleURLTracker::UNIT_TEST_MODE)); | |
335 google_url_tracker_->infobar_creator_ = base::Bind( | 310 google_url_tracker_->infobar_creator_ = base::Bind( |
336 &GoogleURLTrackerTest::CreateTestInfoBar, base::Unretained(this)); | 311 &GoogleURLTrackerTest::CreateTestInfoBar, base::Unretained(this)); |
337 } | 312 } |
338 | 313 |
339 void GoogleURLTrackerTest::TearDown() { | 314 void GoogleURLTrackerTest::TearDown() { |
340 while (!unique_ids_seen_.empty()) | 315 while (!unique_ids_seen_.empty()) |
341 CloseTab(*unique_ids_seen_.begin()); | 316 CloseTab(*unique_ids_seen_.begin()); |
317 google_url_tracker_->Shutdown(); | |
blundell
2014/05/26 12:19:34
This is the fix, which fixes a latent bug that thi
Peter Kasting
2014/05/28 19:18:50
Is there some way to use the service factory syste
blundell
2014/05/28 19:19:51
I'm going to be componentizing this unittest where
| |
342 } | 318 } |
343 | 319 |
344 net::TestURLFetcher* GoogleURLTrackerTest::GetFetcher() { | 320 net::TestURLFetcher* GoogleURLTrackerTest::GetFetcher() { |
345 // This will return the last fetcher created. If no fetchers have been | 321 // This will return the last fetcher created. If no fetchers have been |
346 // created, we'll pass GetFetcherByID() "-1", and it will return NULL. | 322 // created, we'll pass GetFetcherByID() "-1", and it will return NULL. |
347 return fetcher_factory_.GetFetcherByID(google_url_tracker_->fetcher_id_ - 1); | 323 return fetcher_factory_.GetFetcherByID(google_url_tracker_->fetcher_id_ - 1); |
348 } | 324 } |
349 | 325 |
350 void GoogleURLTrackerTest::MockSearchDomainCheckResponse( | 326 void GoogleURLTrackerTest::MockSearchDomainCheckResponse( |
351 const std::string& domain) { | 327 const std::string& domain) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
388 void GoogleURLTrackerTest::SetNavigationPending(intptr_t unique_id, | 364 void GoogleURLTrackerTest::SetNavigationPending(intptr_t unique_id, |
389 bool is_search) { | 365 bool is_search) { |
390 if (is_search) { | 366 if (is_search) { |
391 google_url_tracker_->SearchCommitted(); | 367 google_url_tracker_->SearchCommitted(); |
392 // Note that the call above might not have actually registered a listener | 368 // Note that the call above might not have actually registered a listener |
393 // for navigation starts if the searchdomaincheck response was bogus. | 369 // for navigation starts if the searchdomaincheck response was bogus. |
394 } | 370 } |
395 unique_ids_seen_.insert(unique_id); | 371 unique_ids_seen_.insert(unique_id); |
396 if (client_->IsListeningForNavigationStart()) { | 372 if (client_->IsListeningForNavigationStart()) { |
397 google_url_tracker_->OnNavigationPending( | 373 google_url_tracker_->OnNavigationPending( |
398 reinterpret_cast<content::NavigationController*>(unique_id), | 374 scoped_ptr<GoogleURLTrackerNavigationHelper>( |
399 reinterpret_cast<InfoBarService*>(unique_id), unique_id); | 375 new TestGoogleURLTrackerNavigationHelper( |
376 google_url_tracker_.get())), | |
377 reinterpret_cast<InfoBarService*>(unique_id), | |
378 unique_id); | |
400 } | 379 } |
401 } | 380 } |
402 | 381 |
403 void GoogleURLTrackerTest::CommitNonSearch(intptr_t unique_id) { | 382 void GoogleURLTrackerTest::CommitNonSearch(intptr_t unique_id) { |
404 GoogleURLTrackerMapEntry* map_entry = GetMapEntry(unique_id); | 383 GoogleURLTrackerMapEntry* map_entry = GetMapEntry(unique_id); |
405 if (!map_entry) | 384 if (!map_entry) |
406 return; | 385 return; |
407 | 386 |
408 ExpectListeningForCommit(unique_id, false); | 387 ExpectListeningForCommit(unique_id, false); |
409 | 388 |
410 // The infobar should be showing; otherwise the pending non-search should | 389 // The infobar should be showing; otherwise the pending non-search should |
411 // have closed it. | 390 // have closed it. |
412 ASSERT_TRUE(map_entry->has_infobar_delegate()); | 391 ASSERT_TRUE(map_entry->has_infobar_delegate()); |
413 | 392 |
414 // The pending_id should have been reset to 0 when the non-search became | 393 // The pending_id should have been reset to 0 when the non-search became |
415 // pending. | 394 // pending. |
416 EXPECT_EQ(0, map_entry->infobar_delegate()->pending_id()); | 395 EXPECT_EQ(0, map_entry->infobar_delegate()->pending_id()); |
417 | 396 |
418 // Committing the navigation would close the infobar. | 397 // Committing the navigation would close the infobar. |
419 map_entry->infobar_delegate()->Close(false); | 398 map_entry->infobar_delegate()->Close(false); |
420 } | 399 } |
421 | 400 |
422 void GoogleURLTrackerTest::CommitSearch(intptr_t unique_id, | 401 void GoogleURLTrackerTest::CommitSearch(intptr_t unique_id, |
423 const GURL& search_url) { | 402 const GURL& search_url) { |
424 DCHECK(search_url.is_valid()); | 403 DCHECK(search_url.is_valid()); |
425 if (nav_helper_->IsListeningForNavigationCommit( | 404 GoogleURLTrackerNavigationHelper* nav_helper = GetNavigationHelper(unique_id); |
426 reinterpret_cast<content::NavigationController*>(unique_id))) { | 405 if (nav_helper && nav_helper->IsListeningForNavigationCommit()) { |
427 google_url_tracker_->OnNavigationCommitted( | 406 google_url_tracker_->OnNavigationCommitted( |
428 reinterpret_cast<InfoBarService*>(unique_id), search_url); | 407 reinterpret_cast<InfoBarService*>(unique_id), search_url); |
429 } | 408 } |
430 } | 409 } |
431 | 410 |
432 void GoogleURLTrackerTest::CloseTab(intptr_t unique_id) { | 411 void GoogleURLTrackerTest::CloseTab(intptr_t unique_id) { |
433 unique_ids_seen_.erase(unique_id); | 412 unique_ids_seen_.erase(unique_id); |
434 content::NavigationController* nav_controller = | 413 GoogleURLTrackerNavigationHelper* nav_helper = GetNavigationHelper(unique_id); |
435 reinterpret_cast<content::NavigationController*>(unique_id); | 414 if (nav_helper && nav_helper->IsListeningForTabDestruction()) { |
436 if (nav_helper_->IsListeningForTabDestruction(nav_controller)) { | 415 google_url_tracker_->OnTabClosed(nav_helper); |
437 google_url_tracker_->OnTabClosed(nav_controller); | |
438 } else { | 416 } else { |
439 // Closing a tab with an infobar showing would close the infobar. | 417 // Closing a tab with an infobar showing would close the infobar. |
440 GoogleURLTrackerInfoBarDelegate* delegate = GetInfoBarDelegate(unique_id); | 418 GoogleURLTrackerInfoBarDelegate* delegate = GetInfoBarDelegate(unique_id); |
441 if (delegate) | 419 if (delegate) |
442 delegate->Close(false); | 420 delegate->Close(false); |
443 } | 421 } |
444 } | 422 } |
445 | 423 |
446 GoogleURLTrackerMapEntry* GoogleURLTrackerTest::GetMapEntry( | 424 GoogleURLTrackerMapEntry* GoogleURLTrackerTest::GetMapEntry( |
447 intptr_t unique_id) { | 425 intptr_t unique_id) { |
448 GoogleURLTracker::EntryMap::const_iterator i = | 426 GoogleURLTracker::EntryMap::const_iterator i = |
449 google_url_tracker_->entry_map_.find( | 427 google_url_tracker_->entry_map_.find( |
450 reinterpret_cast<InfoBarService*>(unique_id)); | 428 reinterpret_cast<InfoBarService*>(unique_id)); |
451 return (i == google_url_tracker_->entry_map_.end()) ? NULL : i->second; | 429 return (i == google_url_tracker_->entry_map_.end()) ? NULL : i->second; |
452 } | 430 } |
453 | 431 |
454 GoogleURLTrackerInfoBarDelegate* GoogleURLTrackerTest::GetInfoBarDelegate( | 432 GoogleURLTrackerInfoBarDelegate* GoogleURLTrackerTest::GetInfoBarDelegate( |
455 intptr_t unique_id) { | 433 intptr_t unique_id) { |
456 GoogleURLTrackerMapEntry* map_entry = GetMapEntry(unique_id); | 434 GoogleURLTrackerMapEntry* map_entry = GetMapEntry(unique_id); |
457 return map_entry ? map_entry->infobar_delegate() : NULL; | 435 return map_entry ? map_entry->infobar_delegate() : NULL; |
458 } | 436 } |
459 | 437 |
438 GoogleURLTrackerNavigationHelper* GoogleURLTrackerTest::GetNavigationHelper( | |
439 intptr_t unique_id) { | |
440 GoogleURLTrackerMapEntry* map_entry = GetMapEntry(unique_id); | |
441 return map_entry ? map_entry->navigation_helper() : NULL; | |
442 } | |
443 | |
460 void GoogleURLTrackerTest::ExpectDefaultURLs() const { | 444 void GoogleURLTrackerTest::ExpectDefaultURLs() const { |
461 EXPECT_EQ(GURL(GoogleURLTracker::kDefaultGoogleHomepage), google_url()); | 445 EXPECT_EQ(GURL(GoogleURLTracker::kDefaultGoogleHomepage), google_url()); |
462 EXPECT_EQ(GURL(), fetched_google_url()); | 446 EXPECT_EQ(GURL(), fetched_google_url()); |
463 } | 447 } |
464 | 448 |
465 void GoogleURLTrackerTest::ExpectListeningForCommit(intptr_t unique_id, | 449 void GoogleURLTrackerTest::ExpectListeningForCommit(intptr_t unique_id, |
466 bool listening) { | 450 bool listening) { |
467 GoogleURLTrackerMapEntry* map_entry = GetMapEntry(unique_id); | 451 GoogleURLTrackerMapEntry* map_entry = GetMapEntry(unique_id); |
468 if (map_entry) { | 452 if (map_entry) { |
469 EXPECT_EQ(listening, nav_helper_->IsListeningForNavigationCommit( | 453 EXPECT_EQ(listening, |
470 map_entry->navigation_controller())); | 454 map_entry->navigation_helper()->IsListeningForNavigationCommit()); |
471 } else { | 455 } else { |
472 EXPECT_FALSE(listening); | 456 EXPECT_FALSE(listening); |
473 } | 457 } |
474 } | 458 } |
475 | 459 |
476 infobars::InfoBar* GoogleURLTrackerTest::CreateTestInfoBar( | 460 infobars::InfoBar* GoogleURLTrackerTest::CreateTestInfoBar( |
477 InfoBarService* infobar_service, | 461 InfoBarService* infobar_service, |
478 GoogleURLTracker* google_url_tracker, | 462 GoogleURLTracker* google_url_tracker, |
479 const GURL& search_url) { | 463 const GURL& search_url) { |
480 return TestInfoBarDelegate::Create(this, infobar_service, google_url_tracker, | 464 return TestInfoBarDelegate::Create(this, infobar_service, google_url_tracker, |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1103 CommitSearch(2, GURL("http://www.google.co.uk/search?q=test2")); | 1087 CommitSearch(2, GURL("http://www.google.co.uk/search?q=test2")); |
1104 EXPECT_FALSE(GetInfoBarDelegate(1) == NULL); | 1088 EXPECT_FALSE(GetInfoBarDelegate(1) == NULL); |
1105 GoogleURLTrackerInfoBarDelegate* delegate2 = GetInfoBarDelegate(2); | 1089 GoogleURLTrackerInfoBarDelegate* delegate2 = GetInfoBarDelegate(2); |
1106 ASSERT_FALSE(delegate2 == NULL); | 1090 ASSERT_FALSE(delegate2 == NULL); |
1107 SetNavigationPending(1, true); | 1091 SetNavigationPending(1, true); |
1108 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(1, true)); | 1092 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(1, true)); |
1109 delegate2->Close(false); | 1093 delegate2->Close(false); |
1110 SetNavigationPending(1, false); | 1094 SetNavigationPending(1, false); |
1111 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(1, false)); | 1095 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(1, false)); |
1112 } | 1096 } |
OLD | NEW |