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