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

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

Issue 6247020: Fix leak. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 11 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/browser_thread.h" 10 #include "chrome/browser/browser_thread.h"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 288
289 void GoogleURLTrackerTest::CancelGoogleURL() { 289 void GoogleURLTrackerTest::CancelGoogleURL() {
290 TestInfoBarDelegate* infobar = static_cast<TestInfoBarDelegate*>( 290 TestInfoBarDelegate* infobar = static_cast<TestInfoBarDelegate*>(
291 g_browser_process->google_url_tracker()->infobar_); 291 g_browser_process->google_url_tracker()->infobar_);
292 ASSERT_TRUE(infobar); 292 ASSERT_TRUE(infobar);
293 ASSERT_TRUE(infobar->google_url_tracker()); 293 ASSERT_TRUE(infobar->google_url_tracker());
294 infobar->google_url_tracker()->CancelGoogleURL(infobar->new_google_url()); 294 infobar->google_url_tracker()->CancelGoogleURL(infobar->new_google_url());
295 } 295 }
296 296
297 void GoogleURLTrackerTest::InfoBarClosed() { 297 void GoogleURLTrackerTest::InfoBarClosed() {
298 TestInfoBarDelegate* infobar = static_cast<TestInfoBarDelegate*>( 298 InfoBarDelegate* infobar = g_browser_process->google_url_tracker()->infobar_;
299 g_browser_process->google_url_tracker()->infobar_);
300 ASSERT_TRUE(infobar); 299 ASSERT_TRUE(infobar);
301 ASSERT_TRUE(infobar->google_url_tracker()); 300 GoogleURLTracker* url_tracker =
302 infobar->google_url_tracker()->InfoBarClosed(); 301 static_cast<TestInfoBarDelegate*>(infobar)->google_url_tracker();
303 delete g_browser_process->google_url_tracker()->infobar_; 302 ASSERT_TRUE(url_tracker);
303 url_tracker->InfoBarClosed();
304 delete infobar;
304 } 305 }
305 306
306 void GoogleURLTrackerTest::ExpectDefaultURLs() { 307 void GoogleURLTrackerTest::ExpectDefaultURLs() {
307 EXPECT_EQ(GURL(GoogleURLTracker::kDefaultGoogleHomepage), 308 EXPECT_EQ(GURL(GoogleURLTracker::kDefaultGoogleHomepage),
308 GoogleURLTracker::GoogleURL()); 309 GoogleURLTracker::GoogleURL());
309 EXPECT_EQ(GURL(), GetFetchedGoogleURL()); 310 EXPECT_EQ(GURL(), GetFetchedGoogleURL());
310 } 311 }
311 312
312 313
313 // Tests ---------------------------------------------------------------------- 314 // Tests ----------------------------------------------------------------------
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 NavEntryCommitted(); 482 NavEntryCommitted();
482 EXPECT_TRUE(InfoBarIsShown()); 483 EXPECT_TRUE(InfoBarIsShown());
483 484
484 AcceptGoogleURL(); 485 AcceptGoogleURL();
485 InfoBarClosed(); 486 InfoBarClosed();
486 EXPECT_FALSE(InfoBarIsShown()); 487 EXPECT_FALSE(InfoBarIsShown());
487 EXPECT_EQ(GURL("http://www.google.co.jp/"), GoogleURLTracker::GoogleURL()); 488 EXPECT_EQ(GURL("http://www.google.co.jp/"), GoogleURLTracker::GoogleURL());
488 EXPECT_EQ(GURL("http://www.google.co.jp/"), GetLastPromptedGoogleURL()); 489 EXPECT_EQ(GURL("http://www.google.co.jp/"), GetLastPromptedGoogleURL());
489 EXPECT_TRUE(observer_->notified()); 490 EXPECT_TRUE(observer_->notified());
490 } 491 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698