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

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

Issue 1459793002: Android: Allow compiling browser without Java UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 e33acba4d82811a21d7f142d86537eba91f46aba..ddd69c1ecc7b6a4fc3aafc1ec0dd9df919534aa2 100644
--- a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
@@ -44,7 +44,7 @@
#include "content/public/test/web_contents_tester.h"
#include "testing/gtest/include/gtest/gtest.h"
-#if defined(OS_ANDROID)
+#if defined(ANDROID_JAVA_UI)
#include "base/prefs/pref_service.h"
#include "chrome/browser/android/mock_location_settings.h"
#include "chrome/browser/geolocation/geolocation_permission_context_android.h"
@@ -143,7 +143,7 @@ class GeolocationPermissionContextTests
void AddNewTab(const GURL& url);
void CheckTabContentsState(const GURL& requesting_frame,
ContentSetting expected_content_setting);
-#if !defined(OS_ANDROID)
+#if !defined(ANDROID_JAVA_UI)
size_t GetBubblesQueueSize(PermissionBubbleManager* manager);
void AcceptBubble(PermissionBubbleManager* manager);
void DenyBubble(PermissionBubbleManager* manager);
@@ -239,7 +239,7 @@ void GeolocationPermissionContextTests::AddNewTab(const GURL& url) {
#if defined(ENABLE_EXTENSIONS)
extensions::SetViewType(new_tab, extensions::VIEW_TYPE_TAB_CONTENTS);
#endif
-#if defined(OS_ANDROID)
+#if defined(ANDROID_JAVA_UI)
InfoBarService::CreateForWebContents(new_tab);
#else
PermissionBubbleManager::CreateForWebContents(new_tab);
@@ -279,7 +279,7 @@ void GeolocationPermissionContextTests::SetUp() {
TabSpecificContentSettings::CreateForWebContents(web_contents());
geolocation_permission_context_ =
GeolocationPermissionContextFactory::GetForProfile(profile());
-#if defined(OS_ANDROID)
+#if defined(ANDROID_JAVA_UI)
static_cast<GeolocationPermissionContextAndroid*>(
geolocation_permission_context_)
->SetLocationSettingsForTesting(
@@ -299,7 +299,7 @@ void GeolocationPermissionContextTests::TearDown() {
ChromeRenderViewHostTestHarness::TearDown();
}
-#if !defined(OS_ANDROID)
+#if !defined(ANDROID_JAVA_UI)
size_t GeolocationPermissionContextTests::GetBubblesQueueSize(
PermissionBubbleManager* manager) {
return manager->requests_.size();
@@ -328,7 +328,7 @@ void GeolocationPermissionContextTests::BubbleManagerDocumentLoadCompleted() {
void GeolocationPermissionContextTests::BubbleManagerDocumentLoadCompleted(
content::WebContents* web_contents) {
-#if !defined(OS_ANDROID)
+#if !defined(ANDROID_JAVA_UI)
PermissionBubbleManager::FromWebContents(web_contents)->
DocumentOnLoadCompletedInMainFrame();
#endif
@@ -344,7 +344,7 @@ ContentSetting GeolocationPermissionContextTests::GetGeolocationContentSetting(
}
size_t GeolocationPermissionContextTests::GetNumberOfPrompts() {
-#if !defined(OS_ANDROID)
+#if !defined(ANDROID_JAVA_UI)
PermissionBubbleManager* manager =
PermissionBubbleManager::FromWebContents(web_contents());
return GetBubblesQueueSize(manager);
@@ -354,7 +354,7 @@ size_t GeolocationPermissionContextTests::GetNumberOfPrompts() {
}
void GeolocationPermissionContextTests::AcceptPrompt() {
-#if !defined(OS_ANDROID)
+#if !defined(ANDROID_JAVA_UI)
PermissionBubbleManager* manager =
PermissionBubbleManager::FromWebContents(web_contents());
AcceptBubble(manager);
@@ -367,7 +367,7 @@ void GeolocationPermissionContextTests::AcceptPrompt() {
}
base::string16 GeolocationPermissionContextTests::GetPromptText() {
-#if !defined(OS_ANDROID)
+#if !defined(ANDROID_JAVA_UI)
PermissionBubbleManager* manager =
PermissionBubbleManager::FromWebContents(web_contents());
return manager->requests_.front()->GetMessageText();
@@ -392,7 +392,7 @@ TEST_F(GeolocationPermissionContextTests, SinglePermissionBubble) {
ASSERT_EQ(1U, GetNumberOfPrompts());
}
-#if defined(OS_ANDROID)
+#if defined(ANDROID_JAVA_UI)
TEST_F(GeolocationPermissionContextTests, SinglePermissionInfobar) {
GURL requesting_frame("http://www.example.com/geolocation");
NavigateAndCommit(requesting_frame);
@@ -490,7 +490,7 @@ TEST_F(GeolocationPermissionContextTests, QueuedPermission) {
CheckTabContentsState(requesting_frame_0, CONTENT_SETTING_ALLOW);
CheckPermissionMessageSent(0, true);
-#if defined(OS_ANDROID)
+#if defined(ANDROID_JAVA_UI)
infobars::InfoBar* infobar_0 = infobar_service()->infobar_at(0);
infobar_service()->RemoveInfoBar(infobar_0);
EXPECT_EQ(1U, closed_infobar_tracker_.size());
@@ -506,7 +506,7 @@ TEST_F(GeolocationPermissionContextTests, QueuedPermission) {
EXPECT_NE(text_0, text_1);
// Cancel (block) this frame.
-#if !defined(OS_ANDROID)
+#if !defined(ANDROID_JAVA_UI)
PermissionBubbleManager* manager =
PermissionBubbleManager::FromWebContents(web_contents());
DenyBubble(manager);
@@ -536,7 +536,7 @@ TEST_F(GeolocationPermissionContextTests, HashIsIgnored) {
// Check permission is requested.
ASSERT_EQ(0U, GetNumberOfPrompts());
-#if defined(OS_ANDROID)
+#if defined(ANDROID_JAVA_UI)
const bool user_gesture = false;
#else
const bool user_gesture = true;
@@ -556,7 +556,7 @@ TEST_F(GeolocationPermissionContextTests, HashIsIgnored) {
CheckPermissionMessageSent(0, true);
// Cleanup.
-#if defined(OS_ANDROID)
+#if defined(ANDROID_JAVA_UI)
infobars::InfoBar* infobar = infobar_service()->infobar_at(0);
infobar_service()->RemoveInfoBar(infobar);
EXPECT_EQ(1U, closed_infobar_tracker_.size());
@@ -566,7 +566,7 @@ TEST_F(GeolocationPermissionContextTests, HashIsIgnored) {
// TODO(felt): The bubble is rejecting file:// permission requests.
// Fix and enable this test. crbug.com/444047
-#if defined(OS_ANDROID)
+#if defined(ANDROID_JAVA_UI)
#define MAYBE_PermissionForFileScheme PermissionForFileScheme
#else
#define MAYBE_PermissionForFileScheme DISABLED_PermissionForFileScheme
@@ -618,7 +618,7 @@ TEST_F(GeolocationPermissionContextTests, CancelGeolocationPermissionRequest) {
ASSERT_FALSE(text_0.empty());
// Simulate the frame going away; the request should be removed.
-#if !defined(OS_ANDROID)
+#if !defined(ANDROID_JAVA_UI)
PermissionBubbleManager* manager =
PermissionBubbleManager::FromWebContents(web_contents());
CloseBubble(manager);
@@ -667,7 +667,7 @@ TEST_F(GeolocationPermissionContextTests, SameOriginMultipleTabs) {
BubbleManagerDocumentLoadCompleted();
BubbleManagerDocumentLoadCompleted(extra_tabs_[0]);
BubbleManagerDocumentLoadCompleted(extra_tabs_[1]);
-#if !defined(OS_ANDROID)
+#if !defined(ANDROID_JAVA_UI)
PermissionBubbleManager* manager_a0 =
PermissionBubbleManager::FromWebContents(web_contents());
PermissionBubbleManager* manager_b =
@@ -684,7 +684,7 @@ TEST_F(GeolocationPermissionContextTests, SameOriginMultipleTabs) {
RequestGeolocationPermission(
extra_tabs_[1], RequestIDForTab(1, 0), url_a, true);
ASSERT_EQ(1U, GetNumberOfPrompts()); // For A0.
-#if !defined(OS_ANDROID)
+#if !defined(ANDROID_JAVA_UI)
ASSERT_EQ(1U, GetBubblesQueueSize(manager_b));
ASSERT_EQ(1U, GetBubblesQueueSize(manager_a1));
#else
@@ -693,7 +693,7 @@ TEST_F(GeolocationPermissionContextTests, SameOriginMultipleTabs) {
#endif
// Accept the permission in tab A0.
-#if !defined(OS_ANDROID)
+#if !defined(ANDROID_JAVA_UI)
AcceptBubble(manager_a0);
#else
infobars::InfoBar* infobar_a0 = infobar_service()->infobar_at(0);
@@ -710,7 +710,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 !defined(OS_ANDROID)
+#if !defined(ANDROID_JAVA_UI)
ASSERT_EQ(1U, GetBubblesQueueSize(manager_a1));
ASSERT_EQ(1U, GetBubblesQueueSize(manager_b));
#else
@@ -724,7 +724,7 @@ TEST_F(GeolocationPermissionContextTests, QueuedOriginMultipleTabs) {
GURL url_b("http://www.example-2.com/geolocation");
NavigateAndCommit(url_a); // Tab A0.
AddNewTab(url_a); // Tab A1.
-#if !defined(OS_ANDROID)
+#if !defined(ANDROID_JAVA_UI)
BubbleManagerDocumentLoadCompleted();
BubbleManagerDocumentLoadCompleted(extra_tabs_[0]);
PermissionBubbleManager* manager_a0 =
@@ -741,7 +741,7 @@ TEST_F(GeolocationPermissionContextTests, QueuedOriginMultipleTabs) {
extra_tabs_[0], RequestIDForTab(0, 0), url_a, true);
RequestGeolocationPermission(
extra_tabs_[0], RequestIDForTab(0, 1), url_b, true);
-#if !defined(OS_ANDROID)
+#if !defined(ANDROID_JAVA_UI)
ASSERT_EQ(1U, GetBubblesQueueSize(manager_a0));
ASSERT_EQ(1U, GetBubblesQueueSize(manager_a1));
#else
@@ -750,7 +750,7 @@ TEST_F(GeolocationPermissionContextTests, QueuedOriginMultipleTabs) {
#endif
// Accept the first request in tab A1.
-#if !defined(OS_ANDROID)
+#if !defined(ANDROID_JAVA_UI)
AcceptBubble(manager_a1);
#else
infobars::InfoBar* infobar_a1 = infobar_service_for_tab(0)->infobar_at(0);
@@ -767,7 +767,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 !defined(OS_ANDROID)
+#if !defined(ANDROID_JAVA_UI)
EXPECT_EQ(1U, GetBubblesQueueSize(manager_a0));
#else
EXPECT_EQ(0U, infobar_service()->infobar_count());
@@ -775,14 +775,14 @@ TEST_F(GeolocationPermissionContextTests, QueuedOriginMultipleTabs) {
#endif
// The second request should now be visible in tab A1.
-#if !defined(OS_ANDROID)
+#if !defined(ANDROID_JAVA_UI)
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 !defined(OS_ANDROID)
+#if !defined(ANDROID_JAVA_UI)
AcceptBubble(manager_a1);
EXPECT_EQ(0U, GetBubblesQueueSize(manager_a1));
#else
@@ -817,7 +817,7 @@ TEST_F(GeolocationPermissionContextTests, TabDestroyed) {
ASSERT_EQ(1U, GetNumberOfPrompts());
// Delete the tab contents.
-#if defined(OS_ANDROID)
+#if defined(ANDROID_JAVA_UI)
infobars::InfoBar* infobar = infobar_service()->infobar_at(0);
DeleteContents();
ASSERT_EQ(1U, closed_infobar_tracker_.size());
@@ -915,7 +915,7 @@ TEST_F(GeolocationPermissionContextTests, LastUsageAuditedMultipleFrames) {
// Accept the first frame.
AcceptPrompt();
-#if defined(OS_ANDROID)
+#if defined(ANDROID_JAVA_UI)
infobar_service()->RemoveInfoBar(infobar_service()->infobar_at(0));
#endif
CheckTabContentsState(requesting_frame_0, CONTENT_SETTING_ALLOW);
@@ -940,7 +940,7 @@ TEST_F(GeolocationPermissionContextTests, LastUsageAuditedMultipleFrames) {
AcceptPrompt();
CheckTabContentsState(requesting_frame_1, CONTENT_SETTING_ALLOW);
CheckPermissionMessageSent(1, true);
-#if defined(OS_ANDROID)
+#if defined(ANDROID_JAVA_UI)
infobar_service()->RemoveInfoBar(infobar_service()->infobar_at(0));
#endif

Powered by Google App Engine
This is Rietveld 408576698