| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/browser_thread.h" | 10 #include "chrome/browser/browser_thread.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 return fetcher_factory_.GetFetcherByID(expected_id); | 199 return fetcher_factory_.GetFetcherByID(expected_id); |
| 200 } | 200 } |
| 201 | 201 |
| 202 void GoogleURLTrackerTest::MockSearchDomainCheckResponse( | 202 void GoogleURLTrackerTest::MockSearchDomainCheckResponse( |
| 203 int expected_id, | 203 int expected_id, |
| 204 const std::string& domain) { | 204 const std::string& domain) { |
| 205 TestURLFetcher* fetcher = fetcher_factory_.GetFetcherByID(expected_id); | 205 TestURLFetcher* fetcher = fetcher_factory_.GetFetcherByID(expected_id); |
| 206 if (!fetcher) | 206 if (!fetcher) |
| 207 return; | 207 return; |
| 208 fetcher->delegate()->OnURLFetchComplete(fetcher, | 208 fetcher->delegate()->OnURLFetchComplete(fetcher, |
| 209 GURL(GoogleURLTracker::kSearchDomainCheckURL), URLRequestStatus(), 200, | 209 GURL(GoogleURLTracker::kSearchDomainCheckURL), net::URLRequestStatus(), |
| 210 ResponseCookies(), domain); | 210 200, ResponseCookies(), domain); |
| 211 // At this point, |fetcher| is deleted. | 211 // At this point, |fetcher| is deleted. |
| 212 MessageLoop::current()->RunAllPending(); | 212 MessageLoop::current()->RunAllPending(); |
| 213 } | 213 } |
| 214 | 214 |
| 215 void GoogleURLTrackerTest::RequestServerCheck() { | 215 void GoogleURLTrackerTest::RequestServerCheck() { |
| 216 if (!registrar_.IsRegistered(observer_.get(), | 216 if (!registrar_.IsRegistered(observer_.get(), |
| 217 NotificationType::GOOGLE_URL_UPDATED, | 217 NotificationType::GOOGLE_URL_UPDATED, |
| 218 NotificationService::AllSources())) { | 218 NotificationService::AllSources())) { |
| 219 registrar_.Add(observer_.get(), NotificationType::GOOGLE_URL_UPDATED, | 219 registrar_.Add(observer_.get(), NotificationType::GOOGLE_URL_UPDATED, |
| 220 NotificationService::AllSources()); | 220 NotificationService::AllSources()); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 NavEntryCommitted(); | 480 NavEntryCommitted(); |
| 481 EXPECT_TRUE(InfoBarIsShown()); | 481 EXPECT_TRUE(InfoBarIsShown()); |
| 482 | 482 |
| 483 AcceptGoogleURL(); | 483 AcceptGoogleURL(); |
| 484 InfoBarClosed(); | 484 InfoBarClosed(); |
| 485 EXPECT_FALSE(InfoBarIsShown()); | 485 EXPECT_FALSE(InfoBarIsShown()); |
| 486 EXPECT_EQ(GURL("http://www.google.co.jp/"), GoogleURLTracker::GoogleURL()); | 486 EXPECT_EQ(GURL("http://www.google.co.jp/"), GoogleURLTracker::GoogleURL()); |
| 487 EXPECT_EQ(GURL("http://www.google.co.jp/"), GetLastPromptedGoogleURL()); | 487 EXPECT_EQ(GURL("http://www.google.co.jp/"), GetLastPromptedGoogleURL()); |
| 488 EXPECT_TRUE(observer_->notified()); | 488 EXPECT_TRUE(observer_->notified()); |
| 489 } | 489 } |
| OLD | NEW |