Index: chrome/browser/geolocation/geolocation_permission_context_unittest.cc |
diff --git a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc |
index 054fb30ae9eb6f9f8457bbba63e89438dc85b870..9eebf1fe374618c6d5ffb8acc8b92821050eff68 100644 |
--- a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc |
+++ b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc |
@@ -22,6 +22,7 @@ |
#include "chrome/browser/content_settings/tab_specific_content_settings.h" |
#include "chrome/browser/geolocation/geolocation_permission_context_factory.h" |
#include "chrome/browser/infobars/infobar_service.h" |
+#include "chrome/browser/permissions/permission_infobar_manager.h" |
#include "chrome/browser/permissions/permission_request_id.h" |
#include "chrome/browser/ui/website_settings/mock_permission_bubble_view.h" |
#include "chrome/browser/ui/website_settings/permission_bubble_manager.h" |
@@ -238,6 +239,7 @@ void GeolocationPermissionContextTests::AddNewTab(const GURL& url) { |
extensions::SetViewType(new_tab, extensions::VIEW_TYPE_TAB_CONTENTS); |
#endif |
InfoBarService::CreateForWebContents(new_tab); |
+ PermissionInfoBarManager::CreateForWebContents(new_tab); |
if (BubbleEnabled()) { |
PermissionBubbleManager::CreateForWebContents(new_tab); |
PermissionBubbleManager* permission_bubble_manager = |
@@ -273,6 +275,7 @@ void GeolocationPermissionContextTests::SetUp() { |
extensions::SetViewType(web_contents(), extensions::VIEW_TYPE_TAB_CONTENTS); |
#endif |
InfoBarService::CreateForWebContents(web_contents()); |
+ PermissionInfoBarManager::CreateForWebContents(web_contents()); |
TabSpecificContentSettings::CreateForWebContents(web_contents()); |
geolocation_permission_context_ = |
GeolocationPermissionContextFactory::GetForProfile(profile()); |
@@ -695,17 +698,19 @@ TEST_F(GeolocationPermissionContextTests, SameOriginMultipleTabs) { |
ASSERT_TRUE(infobar_delegate_a0); |
infobar_delegate_a0->Accept(); |
infobar_service()->RemoveInfoBar(infobar_a0); |
- EXPECT_EQ(2U, closed_infobar_tracker_.size()); |
+ EXPECT_EQ(1U, closed_infobar_tracker_.size()); |
EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar_a0)); |
} |
CheckPermissionMessageSent(0, true); |
- // Because they're the same origin, this will cause tab A1's infobar to |
- // disappear. It does not cause the bubble to disappear: crbug.com/443013. |
- // TODO(felt): Update this test when the bubble's behavior is changed. |
+ // Because they're the same origin, tab_a1's bubble/infobar should disappear. |
+ // In the past, infobar used to disappear and bubble did not. |
+ // Now both have a consistent behviour (albiet broken) of not removing |
+ // the bubble/infobar: see crbug.com/443013. |
+ // TODO(felt): Update this test when this behavior is changed. |
if (BubbleEnabled()) |
ASSERT_EQ(1U, GetBubblesQueueSize(manager_a1)); |
else |
- CheckPermissionMessageSentForTab(1, 0, true); |
+ EXPECT_EQ(1U, infobar_service_for_tab(1)->infobar_count()); |
// Either way, tab B should still have a pending permission request. |
if (BubbleEnabled()) |
@@ -754,20 +759,20 @@ TEST_F(GeolocationPermissionContextTests, QueuedOriginMultipleTabs) { |
ASSERT_TRUE(infobar_delegate_a1); |
infobar_delegate_a1->Accept(); |
infobar_service_for_tab(0)->RemoveInfoBar(infobar_a1); |
- EXPECT_EQ(2U, closed_infobar_tracker_.size()); |
+ EXPECT_EQ(1U, closed_infobar_tracker_.size()); |
EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar_a1)); |
} |
CheckPermissionMessageSentForTab(0, 0, true); |
- // Because they're the same origin, this will cause tab A0's infobar to |
- // disappear. It does not cause the bubble to disappear: crbug.com/443013. |
- // TODO(felt): Update this test when the bubble's behavior is changed. |
- if (BubbleEnabled()) { |
+ // Because they're the same origin, tab_a0's bubble/infobar should disappear. |
+ // In the past, infobar used to disappear and bubble did not. |
+ // Now both have a consistent behviour (albiet broken) of not removing |
+ // the bubble/infobar: see crbug.com/443013. |
+ // TODO(felt): Update this test when this behavior is changed. |
+ if (BubbleEnabled()) |
EXPECT_EQ(1U, GetBubblesQueueSize(manager_a0)); |
- } else { |
- EXPECT_EQ(0U, infobar_service()->infobar_count()); |
- CheckPermissionMessageSent(0, true); |
- } |
+ else |
+ EXPECT_EQ(1U, infobar_service()->infobar_count()); |
// The second request should now be visible in tab A1. |
if (BubbleEnabled()) |