summaryrefslogtreecommitdiffstats
path: root/chrome/browser/google/google_url_tracker_unittest.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-09 22:31:07 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-09 22:31:07 +0000
commit624896101d464fa075a49075331dc2281c821d3b (patch)
tree72a200d60759a89db08378c04eb09f1e76b85d9b /chrome/browser/google/google_url_tracker_unittest.cc
parent67f540544a7d469a9f9ada49e6365ac43650275f (diff)
downloadchromium_src-624896101d464fa075a49075331dc2281c821d3b.zip
chromium_src-624896101d464fa075a49075331dc2281c821d3b.tar.gz
chromium_src-624896101d464fa075a49075331dc2281c821d3b.tar.bz2
Cleanup precursor patch #3: Convert factory class into a simple function pointer, move a few more bits around, remove a portion of a test that isn't important.
BUG=54274 TEST=none Review URL: http://codereview.chromium.org/4661005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65583 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/google/google_url_tracker_unittest.cc')
-rw-r--r--chrome/browser/google/google_url_tracker_unittest.cc37
1 files changed, 12 insertions, 25 deletions
diff --git a/chrome/browser/google/google_url_tracker_unittest.cc b/chrome/browser/google/google_url_tracker_unittest.cc
index 7b8fb10..94cc193 100644
--- a/chrome/browser/google/google_url_tracker_unittest.cc
+++ b/chrome/browser/google/google_url_tracker_unittest.cc
@@ -59,11 +59,12 @@ class TestInfoBarDelegate : public InfoBarDelegate {
const GURL& new_google_url);
virtual ~TestInfoBarDelegate();
+ // InfoBarDelegate
+ virtual InfoBar* CreateInfoBar();
+
GoogleURLTracker* google_url_tracker() const { return google_url_tracker_; }
const GURL& new_google_url() const { return new_google_url_; }
- virtual InfoBar* CreateInfoBar();
-
private:
GoogleURLTracker* google_url_tracker_;
GURL new_google_url_;
@@ -83,20 +84,14 @@ InfoBar* TestInfoBarDelegate::CreateInfoBar() {
return NULL;
}
-} // namespace
-
-
-// TestInfoBarDelegateFactory -------------------------------------------------
+InfoBarDelegate* CreateTestInfobar(
+ TabContents* tab_contents,
+ GoogleURLTracker* google_url_tracker,
+ const GURL& new_google_url) {
+ return new TestInfoBarDelegate(google_url_tracker, new_google_url);
+}
-class TestInfoBarDelegateFactory
- : public GoogleURLTracker::InfoBarDelegateFactory {
- public:
- virtual InfoBarDelegate* CreateInfoBar(TabContents* tab_contents,
- GoogleURLTracker* google_url_tracker,
- const GURL& new_google_url) {
- return new TestInfoBarDelegate(google_url_tracker, new_google_url);
- }
-};
+} // namespace
// GoogleURLTrackerTest -------------------------------------------------------
@@ -167,8 +162,8 @@ void GoogleURLTrackerTest::SetUp() {
URLFetcher::set_factory(&fetcher_factory_);
observer_.reset(new TestNotificationObserver);
- g_browser_process->google_url_tracker()->infobar_factory_.reset(
- new TestInfoBarDelegateFactory);
+ g_browser_process->google_url_tracker()->infobar_creator_ =
+ &CreateTestInfobar;
}
void GoogleURLTrackerTest::TearDown() {
@@ -362,14 +357,6 @@ TEST_F(GoogleURLTrackerTest, UpdatePromptedURLWhenBack) {
EXPECT_EQ(GURL("http://www.google.co.uk/"), GetFetchedGoogleURL());
EXPECT_EQ(GURL("http://www.google.co.uk/"), GoogleURLTracker::GoogleURL());
EXPECT_EQ(GURL("http://www.google.co.uk/"), GetLastPromptedGoogleURL());
-
- SearchCommitted(GURL("http://www.google.co.uk/search?q=test"));
- NavEntryCommitted();
-
- EXPECT_FALSE(InfoBarIsShown());
- EXPECT_EQ(GURL("http://www.google.co.uk/"), GetFetchedGoogleURL());
- EXPECT_EQ(GURL("http://www.google.co.uk/"), GoogleURLTracker::GoogleURL());
- EXPECT_EQ(GURL("http://www.google.co.uk/"), GetLastPromptedGoogleURL());
}
TEST_F(GoogleURLTrackerTest, MonitorNetworkChange) {