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.h" | 10 #include "base/message_loop.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 content::Source<InfoBarService>(infobar_service), | 278 content::Source<InfoBarService>(infobar_service), |
279 content::Details<InfoBarRemovedDetails>(&removed_details)); | 279 content::Details<InfoBarRemovedDetails>(&removed_details)); |
280 | 280 |
281 // Second, simulate the infobar container closing the infobar in response. | 281 // Second, simulate the infobar container closing the infobar in response. |
282 delete infobar; | 282 delete infobar; |
283 } | 283 } |
284 | 284 |
285 GoogleURLTrackerTest::GoogleURLTrackerTest() | 285 GoogleURLTrackerTest::GoogleURLTrackerTest() |
286 : message_loop_(MessageLoop::TYPE_IO), | 286 : message_loop_(MessageLoop::TYPE_IO), |
287 io_thread_(content::BrowserThread::IO, &message_loop_) { | 287 io_thread_(content::BrowserThread::IO, &message_loop_) { |
288 GoogleURLTrackerFactory::GetInstance()->RegisterUserPrefsOnProfile(&profile_); | 288 GoogleURLTrackerFactory::GetInstance()->RegisterUserPrefsOnBrowserContext( |
| 289 &profile_); |
289 } | 290 } |
290 | 291 |
291 GoogleURLTrackerTest::~GoogleURLTrackerTest() { | 292 GoogleURLTrackerTest::~GoogleURLTrackerTest() { |
292 } | 293 } |
293 | 294 |
294 void GoogleURLTrackerTest::SetUp() { | 295 void GoogleURLTrackerTest::SetUp() { |
295 network_change_notifier_.reset(net::NetworkChangeNotifier::CreateMock()); | 296 network_change_notifier_.reset(net::NetworkChangeNotifier::CreateMock()); |
296 // Ownership is passed to google_url_tracker_, but a weak pointer is kept; | 297 // Ownership is passed to google_url_tracker_, but a weak pointer is kept; |
297 // this is safe since GoogleURLTracker keeps the observer for its lifetime. | 298 // this is safe since GoogleURLTracker keeps the observer for its lifetime. |
298 nav_helper_ = new TestGoogleURLTrackerNavigationHelper(); | 299 nav_helper_ = new TestGoogleURLTrackerNavigationHelper(); |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 CommitSearch(2, GURL("http://www.google.co.uk/search?q=test2")); | 1078 CommitSearch(2, GURL("http://www.google.co.uk/search?q=test2")); |
1078 EXPECT_FALSE(GetInfoBar(1) == NULL); | 1079 EXPECT_FALSE(GetInfoBar(1) == NULL); |
1079 GoogleURLTrackerInfoBarDelegate* infobar2 = GetInfoBar(2); | 1080 GoogleURLTrackerInfoBarDelegate* infobar2 = GetInfoBar(2); |
1080 ASSERT_FALSE(infobar2 == NULL); | 1081 ASSERT_FALSE(infobar2 == NULL); |
1081 SetNavigationPending(1, true); | 1082 SetNavigationPending(1, true); |
1082 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(1, true)); | 1083 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(1, true)); |
1083 infobar2->Close(false); | 1084 infobar2->Close(false); |
1084 SetNavigationPending(1, false); | 1085 SetNavigationPending(1, false); |
1085 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(1, false)); | 1086 ASSERT_NO_FATAL_FAILURE(ExpectListeningForCommit(1, false)); |
1086 } | 1087 } |
OLD | NEW |