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

Unified Diff: chrome/browser/geolocation/geolocation_permission_context_unittest.cc

Issue 1686903002: [Abandoned] Rename PermissionBubbleManager to PermissionRequestManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tests compile Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
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 e62eb4b5225d1072ce43c7e0b9d15baa8dee442c..2065a9bda2622ca6713d0a2c2539509a39630dea 100644
--- a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
@@ -55,8 +55,8 @@
#include "chrome/browser/geolocation/geolocation_permission_context_android.h"
#include "components/prefs/pref_service.h"
#else
+#include "chrome/browser/permissions/permission_request_manager.h"
#include "chrome/browser/ui/website_settings/mock_permission_bubble_factory.h"
-#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
#endif
#if defined(ENABLE_EXTENSIONS)
@@ -149,14 +149,14 @@ class GeolocationPermissionContextTests
void CheckTabContentsState(const GURL& requesting_frame,
ContentSetting expected_content_setting);
#if !BUILDFLAG(ANDROID_JAVA_UI)
- void SetupBubbleManager(content::WebContents* web_contents);
- size_t GetBubblesQueueSize(PermissionBubbleManager* manager);
- void AcceptBubble(PermissionBubbleManager* manager);
- void DenyBubble(PermissionBubbleManager* manager);
- void CloseBubble(PermissionBubbleManager* manager);
-#endif
- void BubbleManagerDocumentLoadCompleted();
- void BubbleManagerDocumentLoadCompleted(content::WebContents* web_contents);
+ void SetupRequestManager(content::WebContents* web_contents);
+ size_t GetBubblesQueueSize(PermissionRequestManager* manager);
+ void AcceptBubble(PermissionRequestManager* manager);
+ void DenyBubble(PermissionRequestManager* manager);
+ void CloseBubble(PermissionRequestManager* manager);
+#endif
+ void RequestManagerDocumentLoadCompleted();
+ void RequestManagerDocumentLoadCompleted(content::WebContents* web_contents);
ContentSetting GetGeolocationContentSetting(GURL frame_0, GURL frame_1);
size_t GetNumberOfPrompts();
void AcceptPrompt();
@@ -252,7 +252,7 @@ void GeolocationPermissionContextTests::AddNewTab(const GURL& url) {
#if BUILDFLAG(ANDROID_JAVA_UI)
InfoBarService::CreateForWebContents(new_tab);
#else
- SetupBubbleManager(new_tab);
+ SetupRequestManager(new_tab);
#endif
extra_tabs_.push_back(base::WrapUnique(new_tab));
@@ -293,7 +293,7 @@ void GeolocationPermissionContextTests::SetUp() {
std::unique_ptr<LocationSettings>(new MockLocationSettings()));
MockLocationSettings::SetLocationStatus(true, true);
#else
- SetupBubbleManager(web_contents());
+ SetupRequestManager(web_contents());
#endif
}
@@ -306,51 +306,51 @@ void GeolocationPermissionContextTests::TearDown() {
}
#if !BUILDFLAG(ANDROID_JAVA_UI)
-void GeolocationPermissionContextTests::SetupBubbleManager(
+void GeolocationPermissionContextTests::SetupRequestManager(
content::WebContents* web_contents) {
- // Create PermissionBubbleManager.
- PermissionBubbleManager::CreateForWebContents(web_contents);
- PermissionBubbleManager* permission_bubble_manager =
- PermissionBubbleManager::FromWebContents(web_contents);
+ // Create PermissionRequestManager.
+ PermissionRequestManager::CreateForWebContents(web_contents);
+ PermissionRequestManager* permission_request_manager =
+ PermissionRequestManager::FromWebContents(web_contents);
- // Create a MockPermissionBubbleFactory for the PermissionBubbleManager.
+ // Create a MockPermissionBubbleFactory for the PermissionRequestManager.
mock_permission_bubble_factories_.push_back(base::WrapUnique(
- new MockPermissionBubbleFactory(false, permission_bubble_manager)));
+ new MockPermissionBubbleFactory(false, permission_request_manager)));
- // Prepare the PermissionBubbleManager to display a mock bubble.
- permission_bubble_manager->DisplayPendingRequests();
+ // Prepare the PermissionRequestManager to display a mock bubble.
+ permission_request_manager->DisplayPendingRequests();
}
size_t GeolocationPermissionContextTests::GetBubblesQueueSize(
- PermissionBubbleManager* manager) {
+ PermissionRequestManager* manager) {
return manager->requests_.size();
}
void GeolocationPermissionContextTests::AcceptBubble(
- PermissionBubbleManager* manager) {
+ PermissionRequestManager* manager) {
manager->Accept();
}
void GeolocationPermissionContextTests::DenyBubble(
- PermissionBubbleManager* manager) {
+ PermissionRequestManager* manager) {
manager->Deny();
}
void GeolocationPermissionContextTests::CloseBubble(
- PermissionBubbleManager* manager) {
+ PermissionRequestManager* manager) {
manager->Closing();
}
#endif
-void GeolocationPermissionContextTests::BubbleManagerDocumentLoadCompleted() {
- GeolocationPermissionContextTests::BubbleManagerDocumentLoadCompleted(
+void GeolocationPermissionContextTests::RequestManagerDocumentLoadCompleted() {
+ GeolocationPermissionContextTests::RequestManagerDocumentLoadCompleted(
web_contents());
}
-void GeolocationPermissionContextTests::BubbleManagerDocumentLoadCompleted(
+void GeolocationPermissionContextTests::RequestManagerDocumentLoadCompleted(
content::WebContents* web_contents) {
#if !BUILDFLAG(ANDROID_JAVA_UI)
- PermissionBubbleManager::FromWebContents(web_contents)->
+ PermissionRequestManager::FromWebContents(web_contents)->
DocumentOnLoadCompletedInMainFrame();
#endif
}
@@ -366,8 +366,8 @@ ContentSetting GeolocationPermissionContextTests::GetGeolocationContentSetting(
size_t GeolocationPermissionContextTests::GetNumberOfPrompts() {
#if !BUILDFLAG(ANDROID_JAVA_UI)
- PermissionBubbleManager* manager =
- PermissionBubbleManager::FromWebContents(web_contents());
+ PermissionRequestManager* manager =
+ PermissionRequestManager::FromWebContents(web_contents());
return GetBubblesQueueSize(manager);
#else
return infobar_service()->infobar_count();
@@ -376,8 +376,8 @@ size_t GeolocationPermissionContextTests::GetNumberOfPrompts() {
void GeolocationPermissionContextTests::AcceptPrompt() {
#if !BUILDFLAG(ANDROID_JAVA_UI)
- PermissionBubbleManager* manager =
- PermissionBubbleManager::FromWebContents(web_contents());
+ PermissionRequestManager* manager =
+ PermissionRequestManager::FromWebContents(web_contents());
AcceptBubble(manager);
#else
infobars::InfoBar* infobar = infobar_service()->infobar_at(0);
@@ -389,8 +389,8 @@ void GeolocationPermissionContextTests::AcceptPrompt() {
base::string16 GeolocationPermissionContextTests::GetPromptText() {
#if !BUILDFLAG(ANDROID_JAVA_UI)
- PermissionBubbleManager* manager =
- PermissionBubbleManager::FromWebContents(web_contents());
+ PermissionRequestManager* manager =
+ PermissionRequestManager::FromWebContents(web_contents());
return manager->requests_.front()->GetMessageText();
#else
infobars::InfoBar* infobar = infobar_service()->infobar_at(0);
@@ -405,7 +405,7 @@ base::string16 GeolocationPermissionContextTests::GetPromptText() {
TEST_F(GeolocationPermissionContextTests, SinglePermissionBubble) {
GURL requesting_frame("https://www.example.com/geolocation");
NavigateAndCommit(requesting_frame);
- BubbleManagerDocumentLoadCompleted();
+ RequestManagerDocumentLoadCompleted();
EXPECT_EQ(0U, GetNumberOfPrompts());
RequestGeolocationPermission(web_contents(), RequestID(0), requesting_frame);
@@ -416,7 +416,7 @@ TEST_F(GeolocationPermissionContextTests,
SinglePermissionBubbleFailsOnInsecureOrigin) {
GURL requesting_frame("http://www.example.com/geolocation");
NavigateAndCommit(requesting_frame);
- BubbleManagerDocumentLoadCompleted();
+ RequestManagerDocumentLoadCompleted();
EXPECT_EQ(0U, GetNumberOfPrompts());
RequestGeolocationPermission(web_contents(), RequestID(0), requesting_frame);
@@ -497,7 +497,7 @@ TEST_F(GeolocationPermissionContextTests, QueuedPermission) {
GetGeolocationContentSetting(requesting_frame_1, requesting_frame_1));
NavigateAndCommit(requesting_frame_0);
- BubbleManagerDocumentLoadCompleted();
+ RequestManagerDocumentLoadCompleted();
// Check that no permission requests have happened yet.
EXPECT_EQ(0U, GetNumberOfPrompts());
@@ -533,8 +533,8 @@ TEST_F(GeolocationPermissionContextTests, QueuedPermission) {
// Cancel (block) this frame.
#if !BUILDFLAG(ANDROID_JAVA_UI)
- PermissionBubbleManager* manager =
- PermissionBubbleManager::FromWebContents(web_contents());
+ PermissionRequestManager* manager =
+ PermissionRequestManager::FromWebContents(web_contents());
DenyBubble(manager);
#else
infobars::InfoBar* infobar_1 = infobar_service()->infobar_at(0);
@@ -558,7 +558,7 @@ TEST_F(GeolocationPermissionContextTests, HashIsIgnored) {
// Navigate to the first url.
NavigateAndCommit(url_a);
- BubbleManagerDocumentLoadCompleted();
+ RequestManagerDocumentLoadCompleted();
// Check permission is requested.
ASSERT_EQ(0U, GetNumberOfPrompts());
@@ -567,7 +567,7 @@ TEST_F(GeolocationPermissionContextTests, HashIsIgnored) {
// Change the hash, we'll still be on the same page.
NavigateAndCommit(url_b);
- BubbleManagerDocumentLoadCompleted();
+ RequestManagerDocumentLoadCompleted();
// Accept.
AcceptPrompt();
@@ -594,7 +594,7 @@ TEST_F(GeolocationPermissionContextTests, HashIsIgnored) {
TEST_F(GeolocationPermissionContextTests, MAYBE_PermissionForFileScheme) {
GURL requesting_frame("file://example/geolocation.html");
NavigateAndCommit(requesting_frame);
- BubbleManagerDocumentLoadCompleted();
+ RequestManagerDocumentLoadCompleted();
// Check permission is requested.
ASSERT_EQ(0U, GetNumberOfPrompts());
@@ -621,7 +621,7 @@ TEST_F(GeolocationPermissionContextTests, CancelGeolocationPermissionRequest) {
CONTENT_SETTING_ASK, GetGeolocationContentSetting(frame_1, frame_0));
NavigateAndCommit(frame_0);
- BubbleManagerDocumentLoadCompleted();
+ RequestManagerDocumentLoadCompleted();
ASSERT_EQ(0U, GetNumberOfPrompts());
@@ -636,8 +636,8 @@ TEST_F(GeolocationPermissionContextTests, CancelGeolocationPermissionRequest) {
// Simulate the frame going away; the request should be removed.
#if !BUILDFLAG(ANDROID_JAVA_UI)
- PermissionBubbleManager* manager =
- PermissionBubbleManager::FromWebContents(web_contents());
+ PermissionRequestManager* manager =
+ PermissionRequestManager::FromWebContents(web_contents());
CloseBubble(manager);
#else
geolocation_permission_context_->CancelPermissionRequest(web_contents(),
@@ -665,7 +665,7 @@ TEST_F(GeolocationPermissionContextTests, InvalidURL) {
GURL invalid_embedder("about:blank");
GURL requesting_frame;
NavigateAndCommit(invalid_embedder);
- BubbleManagerDocumentLoadCompleted();
+ RequestManagerDocumentLoadCompleted();
// Nothing should be displayed.
EXPECT_EQ(0U, GetNumberOfPrompts());
@@ -680,16 +680,16 @@ TEST_F(GeolocationPermissionContextTests, SameOriginMultipleTabs) {
NavigateAndCommit(url_a); // Tab A0
AddNewTab(url_b); // Tab B (extra_tabs_[0])
AddNewTab(url_a); // Tab A1 (extra_tabs_[1])
- BubbleManagerDocumentLoadCompleted();
- BubbleManagerDocumentLoadCompleted(extra_tabs_[0].get());
- BubbleManagerDocumentLoadCompleted(extra_tabs_[1].get());
+ RequestManagerDocumentLoadCompleted();
+ RequestManagerDocumentLoadCompleted(extra_tabs_[0].get());
+ RequestManagerDocumentLoadCompleted(extra_tabs_[1].get());
#if !BUILDFLAG(ANDROID_JAVA_UI)
- PermissionBubbleManager* manager_a0 =
- PermissionBubbleManager::FromWebContents(web_contents());
- PermissionBubbleManager* manager_b =
- PermissionBubbleManager::FromWebContents(extra_tabs_[0].get());
- PermissionBubbleManager* manager_a1 =
- PermissionBubbleManager::FromWebContents(extra_tabs_[1].get());
+ PermissionRequestManager* manager_a0 =
+ PermissionRequestManager::FromWebContents(web_contents());
+ PermissionRequestManager* manager_b =
+ PermissionRequestManager::FromWebContents(extra_tabs_[0].get());
+ PermissionRequestManager* manager_a1 =
+ PermissionRequestManager::FromWebContents(extra_tabs_[1].get());
#endif
// Request permission in all three tabs.
@@ -740,12 +740,12 @@ TEST_F(GeolocationPermissionContextTests, QueuedOriginMultipleTabs) {
NavigateAndCommit(url_a); // Tab A0.
AddNewTab(url_a); // Tab A1.
#if !BUILDFLAG(ANDROID_JAVA_UI)
- BubbleManagerDocumentLoadCompleted();
- BubbleManagerDocumentLoadCompleted(extra_tabs_[0].get());
- PermissionBubbleManager* manager_a0 =
- PermissionBubbleManager::FromWebContents(web_contents());
- PermissionBubbleManager* manager_a1 =
- PermissionBubbleManager::FromWebContents(extra_tabs_[0].get());
+ RequestManagerDocumentLoadCompleted();
+ RequestManagerDocumentLoadCompleted(extra_tabs_[0].get());
+ PermissionRequestManager* manager_a0 =
+ PermissionRequestManager::FromWebContents(web_contents());
+ PermissionRequestManager* manager_a1 =
+ PermissionRequestManager::FromWebContents(extra_tabs_[0].get());
#endif
// Request permission in both tabs; the extra tab will have two permission
@@ -819,7 +819,7 @@ TEST_F(GeolocationPermissionContextTests, TabDestroyed) {
GetGeolocationContentSetting(requesting_frame_1, requesting_frame_0));
NavigateAndCommit(requesting_frame_0);
- BubbleManagerDocumentLoadCompleted();
+ RequestManagerDocumentLoadCompleted();
// Request permission for two frames.
RequestGeolocationPermission(
@@ -850,7 +850,7 @@ TEST_F(GeolocationPermissionContextTests, TabDestroyed) {
TEST_F(GeolocationPermissionContextTests, LastUsageAudited) {
GURL requesting_frame("https://www.example.com/geolocation");
NavigateAndCommit(requesting_frame);
- BubbleManagerDocumentLoadCompleted();
+ RequestManagerDocumentLoadCompleted();
base::SimpleTestClock* test_clock = new base::SimpleTestClock;
test_clock->SetNow(base::Time::UnixEpoch() +
@@ -912,7 +912,7 @@ TEST_F(GeolocationPermissionContextTests, LastUsageAuditedMultipleFrames) {
0);
NavigateAndCommit(requesting_frame_0);
- BubbleManagerDocumentLoadCompleted();
+ RequestManagerDocumentLoadCompleted();
EXPECT_EQ(0U, GetNumberOfPrompts());

Powered by Google App Engine
This is Rietveld 408576698