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

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

Issue 2619603002: Remove android_java_ui as it is not used (Closed)
Patch Set: Rebase to master Created 3 years, 11 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 a0e8add807e10d4e6c8302834c67b32a1f41a4fc..6385a45849eaecaec83e0037a212740aaadef10a 100644
--- a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
@@ -51,7 +51,7 @@
#include "extensions/features/features.h"
#include "testing/gtest/include/gtest/gtest.h"
-#if BUILDFLAG(ANDROID_JAVA_UI)
+#if defined(OS_ANDROID)
#include "chrome/browser/android/mock_location_settings.h"
#include "chrome/browser/geolocation/geolocation_permission_context_android.h"
#include "components/prefs/pref_service.h"
@@ -150,7 +150,7 @@ class GeolocationPermissionContextTests
void AddNewTab(const GURL& url);
void CheckTabContentsState(const GURL& requesting_frame,
ContentSetting expected_content_setting);
-#if !BUILDFLAG(ANDROID_JAVA_UI)
+#if !defined(OS_ANDROID)
void SetupRequestManager(content::WebContents* web_contents);
size_t GetBubblesQueueSize(PermissionRequestManager* manager);
void AcceptBubble(PermissionRequestManager* manager);
@@ -168,7 +168,7 @@ class GeolocationPermissionContextTests
GeolocationPermissionContext* geolocation_permission_context_;
ClosedInfoBarTracker closed_infobar_tracker_;
std::vector<std::unique_ptr<content::WebContents>> extra_tabs_;
-#if !BUILDFLAG(ANDROID_JAVA_UI)
+#if !defined(OS_ANDROID)
std::vector<std::unique_ptr<MockPermissionPromptFactory>>
mock_permission_prompt_factories_;
#endif
@@ -252,7 +252,7 @@ void GeolocationPermissionContextTests::AddNewTab(const GURL& url) {
extensions::SetViewType(new_tab, extensions::VIEW_TYPE_TAB_CONTENTS);
#endif
-#if BUILDFLAG(ANDROID_JAVA_UI)
+#if defined(OS_ANDROID)
InfoBarService::CreateForWebContents(new_tab);
#else
SetupRequestManager(new_tab);
@@ -289,7 +289,7 @@ void GeolocationPermissionContextTests::SetUp() {
geolocation_permission_context_ = static_cast<GeolocationPermissionContext*>(
PermissionManager::Get(profile())->GetPermissionContext(
content::PermissionType::GEOLOCATION));
-#if BUILDFLAG(ANDROID_JAVA_UI)
+#if defined(OS_ANDROID)
static_cast<GeolocationPermissionContextAndroid*>(
geolocation_permission_context_)
->SetLocationSettingsForTesting(
@@ -301,14 +301,14 @@ void GeolocationPermissionContextTests::SetUp() {
}
void GeolocationPermissionContextTests::TearDown() {
-#if !BUILDFLAG(ANDROID_JAVA_UI)
+#if !defined(OS_ANDROID)
mock_permission_prompt_factories_.clear();
#endif
extra_tabs_.clear();
ChromeRenderViewHostTestHarness::TearDown();
}
-#if !BUILDFLAG(ANDROID_JAVA_UI)
+#if !defined(OS_ANDROID)
void GeolocationPermissionContextTests::SetupRequestManager(
content::WebContents* web_contents) {
// Create PermissionRequestManager.
@@ -353,7 +353,7 @@ void GeolocationPermissionContextTests::RequestManagerDocumentLoadCompleted() {
void GeolocationPermissionContextTests::RequestManagerDocumentLoadCompleted(
content::WebContents* web_contents) {
-#if !BUILDFLAG(ANDROID_JAVA_UI)
+#if !defined(OS_ANDROID)
PermissionRequestManager::FromWebContents(web_contents)->
DocumentOnLoadCompletedInMainFrame();
#endif
@@ -369,7 +369,7 @@ ContentSetting GeolocationPermissionContextTests::GetGeolocationContentSetting(
}
size_t GeolocationPermissionContextTests::GetNumberOfPrompts() {
-#if !BUILDFLAG(ANDROID_JAVA_UI)
+#if !defined(OS_ANDROID)
PermissionRequestManager* manager =
PermissionRequestManager::FromWebContents(web_contents());
return GetBubblesQueueSize(manager);
@@ -379,7 +379,7 @@ size_t GeolocationPermissionContextTests::GetNumberOfPrompts() {
}
void GeolocationPermissionContextTests::AcceptPrompt() {
-#if !BUILDFLAG(ANDROID_JAVA_UI)
+#if !defined(OS_ANDROID)
PermissionRequestManager* manager =
PermissionRequestManager::FromWebContents(web_contents());
AcceptBubble(manager);
@@ -392,7 +392,7 @@ void GeolocationPermissionContextTests::AcceptPrompt() {
}
base::string16 GeolocationPermissionContextTests::GetPromptText() {
-#if !BUILDFLAG(ANDROID_JAVA_UI)
+#if !defined(OS_ANDROID)
PermissionRequestManager* manager =
PermissionRequestManager::FromWebContents(web_contents());
PermissionRequest* request = manager->requests_.front();
@@ -431,7 +431,7 @@ TEST_F(GeolocationPermissionContextTests,
ASSERT_EQ(0U, GetNumberOfPrompts());
}
-#if BUILDFLAG(ANDROID_JAVA_UI)
+#if defined(OS_ANDROID)
TEST_F(GeolocationPermissionContextTests, SinglePermissionInfobar) {
GURL requesting_frame("https://www.example.com/geolocation");
NavigateAndCommit(requesting_frame);
@@ -529,7 +529,7 @@ TEST_F(GeolocationPermissionContextTests, QueuedPermission) {
CheckTabContentsState(requesting_frame_0, CONTENT_SETTING_ALLOW);
CheckPermissionMessageSent(0, true);
-#if BUILDFLAG(ANDROID_JAVA_UI)
+#if defined(OS_ANDROID)
infobars::InfoBar* infobar_0 = infobar_service()->infobar_at(0);
infobar_service()->RemoveInfoBar(infobar_0);
EXPECT_EQ(1U, closed_infobar_tracker_.size());
@@ -545,7 +545,7 @@ TEST_F(GeolocationPermissionContextTests, QueuedPermission) {
EXPECT_NE(text_0, text_1);
// Cancel (block) this frame.
-#if !BUILDFLAG(ANDROID_JAVA_UI)
+#if !defined(OS_ANDROID)
PermissionRequestManager* manager =
PermissionRequestManager::FromWebContents(web_contents());
DenyBubble(manager);
@@ -575,7 +575,7 @@ TEST_F(GeolocationPermissionContextTests, HashIsIgnored) {
// Check permission is requested.
ASSERT_EQ(0U, GetNumberOfPrompts());
-#if BUILDFLAG(ANDROID_JAVA_UI)
+#if defined(OS_ANDROID)
const bool user_gesture = false;
#else
const bool user_gesture = true;
@@ -595,7 +595,7 @@ TEST_F(GeolocationPermissionContextTests, HashIsIgnored) {
CheckPermissionMessageSent(0, true);
// Cleanup.
-#if BUILDFLAG(ANDROID_JAVA_UI)
+#if defined(OS_ANDROID)
infobars::InfoBar* infobar = infobar_service()->infobar_at(0);
infobar_service()->RemoveInfoBar(infobar);
EXPECT_EQ(1U, closed_infobar_tracker_.size());
@@ -605,7 +605,7 @@ TEST_F(GeolocationPermissionContextTests, HashIsIgnored) {
// TODO(felt): The bubble is rejecting file:// permission requests.
// Fix and enable this test. crbug.com/444047
-#if BUILDFLAG(ANDROID_JAVA_UI)
+#if defined(OS_ANDROID)
#define MAYBE_PermissionForFileScheme PermissionForFileScheme
#else
#define MAYBE_PermissionForFileScheme DISABLED_PermissionForFileScheme
@@ -657,7 +657,7 @@ TEST_F(GeolocationPermissionContextTests, CancelGeolocationPermissionRequest) {
ASSERT_FALSE(text_0.empty());
// Simulate the frame going away; the request should be removed.
-#if !BUILDFLAG(ANDROID_JAVA_UI)
+#if !defined(OS_ANDROID)
PermissionRequestManager* manager =
PermissionRequestManager::FromWebContents(web_contents());
CloseBubble(manager);
@@ -706,7 +706,7 @@ TEST_F(GeolocationPermissionContextTests, SameOriginMultipleTabs) {
RequestManagerDocumentLoadCompleted();
RequestManagerDocumentLoadCompleted(extra_tabs_[0].get());
RequestManagerDocumentLoadCompleted(extra_tabs_[1].get());
-#if !BUILDFLAG(ANDROID_JAVA_UI)
+#if !defined(OS_ANDROID)
PermissionRequestManager* manager_a0 =
PermissionRequestManager::FromWebContents(web_contents());
PermissionRequestManager* manager_b =
@@ -723,7 +723,7 @@ TEST_F(GeolocationPermissionContextTests, SameOriginMultipleTabs) {
RequestGeolocationPermission(
extra_tabs_[1].get(), RequestIDForTab(1, 0), url_a, true);
ASSERT_EQ(1U, GetNumberOfPrompts()); // For A0.
-#if !BUILDFLAG(ANDROID_JAVA_UI)
+#if !defined(OS_ANDROID)
ASSERT_EQ(1U, GetBubblesQueueSize(manager_b));
ASSERT_EQ(1U, GetBubblesQueueSize(manager_a1));
#else
@@ -732,7 +732,7 @@ TEST_F(GeolocationPermissionContextTests, SameOriginMultipleTabs) {
#endif
// Accept the permission in tab A0.
-#if !BUILDFLAG(ANDROID_JAVA_UI)
+#if !defined(OS_ANDROID)
AcceptBubble(manager_a0);
#else
infobars::InfoBar* infobar_a0 = infobar_service()->infobar_at(0);
@@ -749,7 +749,7 @@ TEST_F(GeolocationPermissionContextTests, SameOriginMultipleTabs) {
// disappear. It does not cause the bubble to disappear: crbug.com/443013.
// TODO(felt): Update this test when the bubble's behavior is changed.
// Either way, tab B should still have a pending permission request.
-#if !BUILDFLAG(ANDROID_JAVA_UI)
+#if !defined(OS_ANDROID)
ASSERT_EQ(1U, GetBubblesQueueSize(manager_a1));
ASSERT_EQ(1U, GetBubblesQueueSize(manager_b));
#else
@@ -763,7 +763,7 @@ TEST_F(GeolocationPermissionContextTests, QueuedOriginMultipleTabs) {
GURL url_b("https://www.example-2.com/geolocation");
NavigateAndCommit(url_a); // Tab A0.
AddNewTab(url_a); // Tab A1.
-#if !BUILDFLAG(ANDROID_JAVA_UI)
+#if !defined(OS_ANDROID)
RequestManagerDocumentLoadCompleted();
RequestManagerDocumentLoadCompleted(extra_tabs_[0].get());
PermissionRequestManager* manager_a0 =
@@ -780,7 +780,7 @@ TEST_F(GeolocationPermissionContextTests, QueuedOriginMultipleTabs) {
extra_tabs_[0].get(), RequestIDForTab(0, 0), url_a, true);
RequestGeolocationPermission(
extra_tabs_[0].get(), RequestIDForTab(0, 1), url_b, true);
-#if !BUILDFLAG(ANDROID_JAVA_UI)
+#if !defined(OS_ANDROID)
ASSERT_EQ(1U, GetBubblesQueueSize(manager_a0));
ASSERT_EQ(1U, GetBubblesQueueSize(manager_a1));
#else
@@ -789,7 +789,7 @@ TEST_F(GeolocationPermissionContextTests, QueuedOriginMultipleTabs) {
#endif
// Accept the first request in tab A1.
-#if !BUILDFLAG(ANDROID_JAVA_UI)
+#if !defined(OS_ANDROID)
AcceptBubble(manager_a1);
#else
infobars::InfoBar* infobar_a1 = infobar_service_for_tab(0)->infobar_at(0);
@@ -806,7 +806,7 @@ TEST_F(GeolocationPermissionContextTests, QueuedOriginMultipleTabs) {
// 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 !BUILDFLAG(ANDROID_JAVA_UI)
+#if !defined(OS_ANDROID)
EXPECT_EQ(1U, GetBubblesQueueSize(manager_a0));
#else
EXPECT_EQ(0U, infobar_service()->infobar_count());
@@ -814,14 +814,14 @@ TEST_F(GeolocationPermissionContextTests, QueuedOriginMultipleTabs) {
#endif
// The second request should now be visible in tab A1.
-#if !BUILDFLAG(ANDROID_JAVA_UI)
+#if !defined(OS_ANDROID)
ASSERT_EQ(1U, GetBubblesQueueSize(manager_a1));
#else
ASSERT_EQ(1U, infobar_service_for_tab(0)->infobar_count());
#endif
// Accept the second request and check that it's gone.
-#if !BUILDFLAG(ANDROID_JAVA_UI)
+#if !defined(OS_ANDROID)
AcceptBubble(manager_a1);
EXPECT_EQ(0U, GetBubblesQueueSize(manager_a1));
#else
@@ -856,7 +856,7 @@ TEST_F(GeolocationPermissionContextTests, TabDestroyed) {
ASSERT_EQ(1U, GetNumberOfPrompts());
// Delete the tab contents.
-#if BUILDFLAG(ANDROID_JAVA_UI)
+#if defined(OS_ANDROID)
infobars::InfoBar* infobar = infobar_service()->infobar_at(0);
DeleteContents();
ASSERT_EQ(1U, closed_infobar_tracker_.size());
@@ -954,7 +954,7 @@ TEST_F(GeolocationPermissionContextTests, LastUsageAuditedMultipleFrames) {
// Accept the first frame.
AcceptPrompt();
-#if BUILDFLAG(ANDROID_JAVA_UI)
+#if defined(OS_ANDROID)
infobar_service()->RemoveInfoBar(infobar_service()->infobar_at(0));
#endif
CheckTabContentsState(requesting_frame_0, CONTENT_SETTING_ALLOW);
@@ -979,7 +979,7 @@ TEST_F(GeolocationPermissionContextTests, LastUsageAuditedMultipleFrames) {
AcceptPrompt();
CheckTabContentsState(requesting_frame_1, CONTENT_SETTING_ALLOW);
CheckPermissionMessageSent(1, true);
-#if BUILDFLAG(ANDROID_JAVA_UI)
+#if defined(OS_ANDROID)
infobar_service()->RemoveInfoBar(infobar_service()->infobar_at(0));
#endif

Powered by Google App Engine
This is Rietveld 408576698