Commit 7df93831 authored by Ian Vollick's avatar Ian Vollick Committed by Commit Bot

Fix more failed unit_tests on Android

With this change, I've disabled SiteSettingsCounterTest.
CountWithTimePeriod (logged crbug.com/981972 for this), and
I've updated a few other tests to account for the fact that
CONTENT_SETTINGS_TYPE_NOTIFICATION does not expect
CONTENT_SETTING_ASK on Android.

See SetWebsiteSetting in
notification_channels_provider_android.cc

Bug: 974405,981972
Change-Id: I28264fe120a4051014c29c4bdf052010d8c842c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1691219Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Reviewed-by: default avatarMounir Lamouri <mlamouri@chromium.org>
Reviewed-by: default avatarChristian Dullweber <dullweber@chromium.org>
Reviewed-by: default avatarJustin DeWitt <dewittj@chromium.org>
Commit-Queue: Ian Vollick <vollick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676149}
parent 4a598e55
......@@ -20,6 +20,8 @@
#if !defined(OS_ANDROID)
#include "content/public/browser/host_zoom_map.h"
#else
#include "base/android/build_info.h"
#endif
namespace {
......@@ -109,6 +111,14 @@ TEST_F(SiteSettingsCounterTest, Count) {
// Test that the counter counts correctly when using a time period.
TEST_F(SiteSettingsCounterTest, CountWithTimePeriod) {
#if defined(OS_ANDROID)
// TODO(crbug.com/981972)
if (base::android::BuildInfo::GetInstance()->sdk_int() >=
base::android::SDK_VERSION_OREO) {
return;
}
#endif
base::SimpleTestClock test_clock;
map()->SetClockForTesting(&test_clock);
......
......@@ -2099,7 +2099,7 @@ TEST_F(HostContentSettingsMapTest, GetPatternsFromScopingType) {
// Testing case: WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE.
host_content_settings_map->SetContentSettingDefaultScope(
primary_url, secondary_url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
std::string(), CONTENT_SETTING_ASK);
std::string(), CONTENT_SETTING_ALLOW);
host_content_settings_map->GetSettingsForOneType(
CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string(), &settings);
......
......@@ -350,12 +350,7 @@ TEST_F(OfflinePageUtilsTest, CheckDuplicateDownloads) {
EXPECT_EQ(OfflinePageUtils::DuplicateCheckResult::NOT_FOUND, result);
}
#if defined(DISABLE_OFFLINE_PAGES_TOUCHLESS)
#define MAYBE_ScheduleDownload DISABLED_ScheduleDownload
#else
#define MAYBE_ScheduleDownload ScheduleDownload
#endif
TEST_F(OfflinePageUtilsTest, MAYBE_ScheduleDownload) {
TEST_F(OfflinePageUtilsTest, ScheduleDownload) {
// Pre-check.
ASSERT_EQ(0, FindRequestByNamespaceAndURL(kDownloadNamespace, kTestPage1Url));
ASSERT_EQ(1, FindRequestByNamespaceAndURL(kDownloadNamespace, kTestPage3Url));
......@@ -394,14 +389,7 @@ TEST_F(OfflinePageUtilsTest, ScheduleDownloadWithFailedFileAcecssRequest) {
}
#endif
#if defined(DISABLE_OFFLINE_PAGES_TOUCHLESS)
#define MAYBE_TestGetCachedOfflinePageSizeBetween \
DISABLED_TestGetCachedOfflinePageSizeBetween
#else
#define MAYBE_TestGetCachedOfflinePageSizeBetween \
TestGetCachedOfflinePageSizeBetween
#endif
TEST_F(OfflinePageUtilsTest, MAYBE_TestGetCachedOfflinePageSizeBetween) {
TEST_F(OfflinePageUtilsTest, TestGetCachedOfflinePageSizeBetween) {
// The clock will be at 03:00:00 after adding pages.
CreateCachedOfflinePages();
......
......@@ -570,8 +570,8 @@ class PermissionContextBaseTests : public ChromeRenderViewHostTestHarness {
// Don't call this more than once in the same test, as it persists data to
// HostContentSettingsMap.
void TestParallelRequests(ContentSetting response) {
TestPermissionContext permission_context(
profile(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
TestPermissionContext permission_context(profile(),
CONTENT_SETTINGS_TYPE_GEOLOCATION);
GURL url("http://www.google.com");
SetUpUrl(url);
......@@ -611,8 +611,8 @@ class PermissionContextBaseTests : public ChromeRenderViewHostTestHarness {
const GURL& virtual_url,
const ContentSetting want_response,
const PermissionStatusSource& want_source) {
TestPermissionContext permission_context(
profile(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
TestPermissionContext permission_context(profile(),
CONTENT_SETTINGS_TYPE_GEOLOCATION);
NavigateAndCommit(loaded_url);
web_contents()->GetController().GetVisibleEntry()->SetVirtualURL(
......
......@@ -3427,7 +3427,6 @@ test("unit_tests") {
"../browser/offline_pages/download_archive_manager_unittest.cc",
"../browser/offline_pages/offline_page_mhtml_archiver_unittest.cc",
"../browser/offline_pages/offline_page_tab_helper_unittest.cc",
"../browser/offline_pages/offline_page_utils_unittest.cc",
"../browser/offline_pages/prefetch/offline_metrics_collector_impl_unittest.cc",
"../browser/offline_pages/prefetch/prefetch_background_task_handler_impl_unittest.cc",
"../browser/offline_pages/prefetch/prefetched_pages_notifier_unittest.cc",
......@@ -3451,6 +3450,7 @@ test("unit_tests") {
} else {
sources += [
"../browser/offline_pages/offline_page_request_handler_unittest.cc",
"../browser/offline_pages/offline_page_utils_unittest.cc",
"../browser/offline_pages/prefetch/prefetch_instance_id_proxy_unittest.cc",
]
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment