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

Unified Diff: trunk/src/chrome/browser/google/google_url_tracker_unittest.cc

Issue 102163002: Revert 238283 "Infobar system refactor." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
Index: trunk/src/chrome/browser/google/google_url_tracker_unittest.cc
===================================================================
--- trunk/src/chrome/browser/google/google_url_tracker_unittest.cc (revision 238401)
+++ trunk/src/chrome/browser/google/google_url_tracker_unittest.cc (working copy)
@@ -31,16 +31,17 @@
class TestInfoBarDelegate : public GoogleURLTrackerInfoBarDelegate {
public:
- // Creates a test infobar and delegate and returns the infobar. Unlike the
- // parent class, this does not add the infobar to |infobar_service|, since
- // that "pointer" is really just a magic number. Thus there is no
- // InfoBarService ownership of the returned object; and since the caller
- // doesn't own the returned object, we rely on |test_harness| cleaning this up
- // eventually in GoogleURLTrackerTest::OnInfoBarClosed() to avoid leaks.
- static InfoBar* Create(GoogleURLTrackerTest* test_harness,
- InfoBarService* infobar_service,
- GoogleURLTracker* google_url_tracker,
- const GURL& search_url);
+ // Creates a test delegate and returns it. Unlike the parent class, this does
+ // not add the infobar to |infobar_service|, since that "pointer" is really
+ // just a magic number. Thus there is no InfoBarService ownership of the
+ // returned object; and since the caller doesn't own the returned object, we
+ // rely on |test_harness| cleaning this up eventually in
+ // GoogleURLTrackerTest::OnInfoBarClosed() to avoid leaks.
+ static GoogleURLTrackerInfoBarDelegate* Create(
+ GoogleURLTrackerTest* test_harness,
+ InfoBarService* infobar_service,
+ GoogleURLTracker* google_url_tracker,
+ const GURL& search_url);
private:
TestInfoBarDelegate(GoogleURLTrackerTest* test_harness,
@@ -199,7 +200,7 @@
class GoogleURLTrackerTest : public testing::Test {
public:
// Called by TestInfoBarDelegate::Close().
- void OnInfoBarClosed(scoped_ptr<InfoBar> infobar,
+ void OnInfoBarClosed(scoped_ptr<InfoBarDelegate> infobar,
InfoBarService* infobar_service);
protected:
@@ -240,9 +241,10 @@
// object, we don't add the created infobar to it. Instead we will simulate
// any helper<->infobar interaction necessary. The returned object will be
// cleaned up in OnInfoBarClosed().
- InfoBar* CreateTestInfoBar(InfoBarService* infobar_service,
- GoogleURLTracker* google_url_tracker,
- const GURL& search_url);
+ GoogleURLTrackerInfoBarDelegate* CreateTestInfoBar(
+ InfoBarService* infobar_service,
+ GoogleURLTracker* google_url_tracker,
+ const GURL& search_url);
// These are required by the TestURLFetchers GoogleURLTracker will create (see
// test_url_fetcher_factory.h).
@@ -261,7 +263,7 @@
std::set<int> unique_ids_seen_;
};
-void GoogleURLTrackerTest::OnInfoBarClosed(scoped_ptr<InfoBar> infobar,
+void GoogleURLTrackerTest::OnInfoBarClosed(scoped_ptr<InfoBarDelegate> infobar,
InfoBarService* infobar_service) {
// First, simulate the InfoBarService firing INFOBAR_REMOVED.
InfoBar::RemovedDetails removed_details(infobar.get(), false);
@@ -269,7 +271,7 @@
google_url_tracker_->entry_map_.find(infobar_service);
ASSERT_FALSE(i == google_url_tracker_->entry_map_.end());
GoogleURLTrackerMapEntry* map_entry = i->second;
- ASSERT_EQ(infobar->delegate(), map_entry->infobar_delegate());
+ ASSERT_EQ(infobar, map_entry->infobar_delegate());
map_entry->Observe(
chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED,
content::Source<InfoBarService>(infobar_service),
@@ -446,7 +448,7 @@
}
}
-InfoBar* GoogleURLTrackerTest::CreateTestInfoBar(
+GoogleURLTrackerInfoBarDelegate* GoogleURLTrackerTest::CreateTestInfoBar(
InfoBarService* infobar_service,
GoogleURLTracker* google_url_tracker,
const GURL& search_url) {
@@ -460,21 +462,20 @@
namespace {
// static
-InfoBar* TestInfoBarDelegate::Create(GoogleURLTrackerTest* test_harness,
- InfoBarService* infobar_service,
- GoogleURLTracker* google_url_tracker,
- const GURL& search_url) {
- return ConfirmInfoBarDelegate::CreateInfoBar(
- scoped_ptr<ConfirmInfoBarDelegate>(new TestInfoBarDelegate(
- test_harness, infobar_service, google_url_tracker,
- search_url))).release();
+GoogleURLTrackerInfoBarDelegate* TestInfoBarDelegate::Create(
+ GoogleURLTrackerTest* test_harness,
+ InfoBarService* infobar_service,
+ GoogleURLTracker* google_url_tracker,
+ const GURL& search_url) {
+ return new TestInfoBarDelegate(test_harness, infobar_service,
+ google_url_tracker, search_url);
}
TestInfoBarDelegate::TestInfoBarDelegate(GoogleURLTrackerTest* test_harness,
InfoBarService* infobar_service,
GoogleURLTracker* google_url_tracker,
const GURL& search_url)
- : GoogleURLTrackerInfoBarDelegate(google_url_tracker, search_url),
+ : GoogleURLTrackerInfoBarDelegate(NULL, google_url_tracker, search_url),
test_harness_(test_harness),
infobar_service_(infobar_service) {
}
@@ -488,7 +489,7 @@
}
void TestInfoBarDelegate::Close(bool redo_search) {
- test_harness_->OnInfoBarClosed(scoped_ptr<InfoBar>(infobar()),
+ test_harness_->OnInfoBarClosed(scoped_ptr<InfoBarDelegate>(this),
infobar_service_);
// WARNING: At this point |this| has been deleted!
}

Powered by Google App Engine
This is Rietveld 408576698