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

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

Issue 8373021: Convert URLFetcher::Delegates to use an interface in content/public/common. Also remove the old U... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync and remove unncessary forward declares Created 9 years, 1 month 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) 2011 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/prefs/browser_prefs.h" 10 #include "chrome/browser/prefs/browser_prefs.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 TestURLFetcher* GoogleURLTrackerTest::GetFetcherByID(int expected_id) { 172 TestURLFetcher* GoogleURLTrackerTest::GetFetcherByID(int expected_id) {
173 return fetcher_factory_.GetFetcherByID(expected_id); 173 return fetcher_factory_.GetFetcherByID(expected_id);
174 } 174 }
175 175
176 void GoogleURLTrackerTest::MockSearchDomainCheckResponse( 176 void GoogleURLTrackerTest::MockSearchDomainCheckResponse(
177 int expected_id, 177 int expected_id,
178 const std::string& domain) { 178 const std::string& domain) {
179 TestURLFetcher* fetcher = fetcher_factory_.GetFetcherByID(expected_id); 179 TestURLFetcher* fetcher = fetcher_factory_.GetFetcherByID(expected_id);
180 if (!fetcher) 180 if (!fetcher)
181 return; 181 return;
182 fetcher->delegate()->OnURLFetchComplete(fetcher, 182 fetcher->set_url(GURL(GoogleURLTracker::kSearchDomainCheckURL));
183 GURL(GoogleURLTracker::kSearchDomainCheckURL), net::URLRequestStatus(), 183 fetcher->set_response_code(200);
184 200, net::ResponseCookies(), domain); 184 fetcher->SetResponseString(domain);
185 fetcher->delegate()->OnURLFetchComplete(fetcher);
185 // At this point, |fetcher| is deleted. 186 // At this point, |fetcher| is deleted.
186 MessageLoop::current()->RunAllPending(); 187 MessageLoop::current()->RunAllPending();
187 } 188 }
188 189
189 void GoogleURLTrackerTest::RequestServerCheck() { 190 void GoogleURLTrackerTest::RequestServerCheck() {
190 if (!registrar_.IsRegistered(observer_.get(), 191 if (!registrar_.IsRegistered(observer_.get(),
191 chrome::NOTIFICATION_GOOGLE_URL_UPDATED, 192 chrome::NOTIFICATION_GOOGLE_URL_UPDATED,
192 content::NotificationService::AllSources())) { 193 content::NotificationService::AllSources())) {
193 registrar_.Add(observer_.get(), chrome::NOTIFICATION_GOOGLE_URL_UPDATED, 194 registrar_.Add(observer_.get(), chrome::NOTIFICATION_GOOGLE_URL_UPDATED,
194 content::NotificationService::AllSources()); 195 content::NotificationService::AllSources());
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 NavEntryCommitted(); 445 NavEntryCommitted();
445 EXPECT_TRUE(InfoBarIsShown()); 446 EXPECT_TRUE(InfoBarIsShown());
446 447
447 AcceptGoogleURL(); 448 AcceptGoogleURL();
448 InfoBarClosed(); 449 InfoBarClosed();
449 EXPECT_FALSE(InfoBarIsShown()); 450 EXPECT_FALSE(InfoBarIsShown());
450 EXPECT_EQ(GURL("http://www.google.co.jp/"), GoogleURLTracker::GoogleURL()); 451 EXPECT_EQ(GURL("http://www.google.co.jp/"), GoogleURLTracker::GoogleURL());
451 EXPECT_EQ(GURL("http://www.google.co.jp/"), GetLastPromptedGoogleURL()); 452 EXPECT_EQ(GURL("http://www.google.co.jp/"), GetLastPromptedGoogleURL());
452 EXPECT_TRUE(observer_->notified()); 453 EXPECT_TRUE(observer_->notified());
453 } 454 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698