| Index: chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc
|
| diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc
|
| index cd583458772eafeae3d2cf0a03beb2ac66ab137a..f907ca602dfe719446cd4f2b13a621dbd5e3db9e 100644
|
| --- a/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc
|
| +++ b/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc
|
| @@ -36,8 +36,6 @@ using content::WebContents;
|
|
|
| // ClosedDelegateTracker ------------------------------------------------------
|
|
|
| -namespace {
|
| -
|
| // We need to track which infobars were closed.
|
| class ClosedDelegateTracker : public content::NotificationObserver {
|
| public:
|
| @@ -57,6 +55,7 @@ class ClosedDelegateTracker : public content::NotificationObserver {
|
| void Clear();
|
|
|
| private:
|
| + FRIEND_TEST_ALL_PREFIXES(GeolocationPermissionContextTests, TabDestroyed);
|
| content::NotificationRegistrar registrar_;
|
| std::set<InfoBarDelegate*> removed_infobar_delegates_;
|
| };
|
| @@ -86,9 +85,6 @@ void ClosedDelegateTracker::Clear() {
|
| removed_infobar_delegates_.clear();
|
| }
|
|
|
| -} // namespace
|
| -
|
| -
|
| // GeolocationPermissionContextTests ------------------------------------------
|
|
|
| // This class sets up GeolocationArbitrator.
|
| @@ -139,8 +135,8 @@ class GeolocationPermissionContextTests : public TabContentsWrapperTestHarness {
|
|
|
| private:
|
| // TabContentsWrapperTestHarness:
|
| - virtual void SetUp();
|
| - virtual void TearDown();
|
| + virtual void SetUp() OVERRIDE;
|
| + virtual void TearDown() OVERRIDE;
|
|
|
| content::TestBrowserThread ui_thread_;
|
| content::MockGeolocation mock_geolocation_;
|
| @@ -239,6 +235,7 @@ void GeolocationPermissionContextTests::SetUp() {
|
| }
|
|
|
| void GeolocationPermissionContextTests::TearDown() {
|
| + extra_tabs_.reset();
|
| mock_geolocation_.TearDown();
|
| TabContentsWrapperTestHarness::TearDown();
|
| }
|
| @@ -471,8 +468,6 @@ TEST_F(GeolocationPermissionContextTests, SameOriginMultipleTabs) {
|
| EXPECT_EQ(1U, closed_delegate_tracker_.size());
|
| EXPECT_TRUE(closed_delegate_tracker_.Contains(infobar_1));
|
| infobar_1->InfoBarClosed();
|
| -
|
| - extra_tabs_.reset();
|
| }
|
|
|
| TEST_F(GeolocationPermissionContextTests, QueuedOriginMultipleTabs) {
|
| @@ -528,8 +523,6 @@ TEST_F(GeolocationPermissionContextTests, QueuedOriginMultipleTabs) {
|
| EXPECT_EQ(1U, closed_delegate_tracker_.size());
|
| EXPECT_TRUE(closed_delegate_tracker_.Contains(infobar_1));
|
| infobar_1->InfoBarClosed();
|
| -
|
| - extra_tabs_.reset();
|
| }
|
|
|
| TEST_F(GeolocationPermissionContextTests, TabDestroyed) {
|
| @@ -567,6 +560,16 @@ TEST_F(GeolocationPermissionContextTests, TabDestroyed) {
|
| // Delete the tab contents.
|
| DeleteContents();
|
| infobar_0->InfoBarClosed();
|
| +
|
| + // During contents destruction, the infobar will have been closed, and a
|
| + // second (with it's own new delegate) will have been created. In Chromium,
|
| + // this would be properly deleted by the InfoBarContainer, but in this unit
|
| + // test, the closest thing we have to that is the ClosedDelegateTracker.
|
| + ASSERT_EQ(2U, closed_delegate_tracker_.size());
|
| + ASSERT_TRUE(closed_delegate_tracker_.Contains(infobar_0));
|
| + closed_delegate_tracker_.removed_infobar_delegates_.erase(infobar_0);
|
| + (*closed_delegate_tracker_.removed_infobar_delegates_.begin())->
|
| + InfoBarClosed();
|
| }
|
|
|
| TEST_F(GeolocationPermissionContextTests, InfoBarUsesCommittedEntry) {
|
| @@ -598,3 +601,5 @@ TEST_F(GeolocationPermissionContextTests, InfoBarUsesCommittedEntry) {
|
| DeleteContents();
|
| infobar_0->InfoBarClosed();
|
| }
|
| +
|
| +
|
|
|