extensions: Add desktop Android support for chrome.alarms API test
Include the runtime API and support the alarms API test on the desktop Android build. Bug: 373434594 Change-Id: I67d85bc43f4699228f0810ce9fca640bcb6d6d77 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5943425 Reviewed-by: Dominic Battré <battre@chromium.org> Commit-Queue: James Cook <jamescook@chromium.org> Reviewed-by: David Bertoni <dbertoni@chromium.org> Cr-Commit-Position: refs/heads/main@{#1372377}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
d144189467
commit
bbe845fbaf
chrome
extensions/browser/api
@ -2,6 +2,10 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "chrome/browser/extensions/extension_platform_apitest.h"
|
||||
#include "content/public/test/browser_test.h"
|
||||
|
||||
#if !BUILDFLAG(IS_ANDROID)
|
||||
#include "base/test/metrics/histogram_tester.h"
|
||||
#include "chrome/browser/extensions/extension_apitest.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
@ -13,11 +17,14 @@
|
||||
#include "extensions/test/result_catcher.h"
|
||||
#include "net/dns/mock_host_resolver.h"
|
||||
#include "net/test/embedded_test_server/embedded_test_server.h"
|
||||
|
||||
using extensions::ResultCatcher;
|
||||
#endif
|
||||
|
||||
namespace extensions {
|
||||
|
||||
#if !BUILDFLAG(IS_ANDROID)
|
||||
|
||||
using extensions::ResultCatcher;
|
||||
|
||||
class AlarmsApiTest : public ExtensionApiTest {
|
||||
public:
|
||||
AlarmsApiTest() = default;
|
||||
@ -103,8 +110,15 @@ IN_PROC_BROWSER_TEST_F(AlarmsApiTest, IncognitoSpanning) {
|
||||
|
||||
EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
|
||||
}
|
||||
#endif // !BUILDFLAG(IS_ANDROID)
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(AlarmsApiTest, Count) {
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
using AlarmsPlatformApiTest = ExtensionPlatformApiTest;
|
||||
#else
|
||||
using AlarmsPlatformApiTest = ExtensionApiTest;
|
||||
#endif
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(AlarmsPlatformApiTest, Count) {
|
||||
EXPECT_TRUE(RunExtensionTest("alarms/count")) << message_;
|
||||
}
|
||||
|
||||
|
@ -203,6 +203,7 @@
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
|
||||
#include "extensions/browser/api/runtime/runtime_api.h"
|
||||
#include "extensions/browser/extension_prefs.h"
|
||||
#include "extensions/browser/permissions_manager.h"
|
||||
#include "extensions/browser/pref_names.h"
|
||||
@ -219,7 +220,6 @@
|
||||
#include "chrome/browser/ui/extensions/settings_api_bubble_helpers.h"
|
||||
#include "chrome/browser/ui/webui/extensions/extensions_ui.h"
|
||||
#include "extensions/browser/api/audio/audio_api.h"
|
||||
#include "extensions/browser/api/runtime/runtime_api.h"
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
#include "chrome/browser/ash/device_name/device_name_store.h"
|
||||
#include "chrome/browser/ash/extensions/extensions_permissions_tracker.h"
|
||||
@ -2088,6 +2088,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
|
||||
extensions::PermissionsManager::RegisterProfilePrefs(registry);
|
||||
extensions::ExtensionPrefs::RegisterProfilePrefs(registry);
|
||||
extensions::RuntimeAPI::RegisterPrefs(registry);
|
||||
#endif // BUILDFLAG(ENABLE_EXTENSIONS_CORE)
|
||||
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
@ -2099,7 +2100,6 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
extensions::shared_storage::RegisterProfilePrefs(registry);
|
||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
extensions::RuntimeAPI::RegisterPrefs(registry);
|
||||
// TODO(devlin): This would be more inline with the other calls here if it
|
||||
// were nested in either a class or separate namespace with a simple
|
||||
// Register[Profile]Prefs() name.
|
||||
|
@ -1691,7 +1691,12 @@ if (is_android) {
|
||||
}
|
||||
|
||||
if (enable_desktop_android_extensions) {
|
||||
sources += [ "../browser/extensions/desktop_android/desktop_android_extensions_browsertest.cc" ]
|
||||
sources += [
|
||||
"../browser/extensions/api/alarms/alarms_apitest.cc",
|
||||
"../browser/extensions/desktop_android/desktop_android_extensions_browsertest.cc",
|
||||
]
|
||||
|
||||
deps += [ "//extensions/common/api" ]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,9 @@
|
||||
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "extensions/browser/api/alarms/alarm_manager.h"
|
||||
#include "extensions/browser/api/declarative_net_request/rules_monitor_service.h"
|
||||
#include "extensions/browser/api/runtime/runtime_api.h"
|
||||
#include "extensions/browser/api/storage/session_storage_manager.h" // nogncheck
|
||||
#include "extensions/browser/api/storage/storage_frontend.h" // nogncheck
|
||||
#include "extensions/browser/api/web_request/web_request_api.h"
|
||||
@ -16,7 +18,6 @@
|
||||
// The following are not supported in the experimental desktop-android build.
|
||||
// TODO(https://crbug.com/356905053): Enable these APIs on desktop-android.
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
#include "extensions/browser/api/alarms/alarm_manager.h"
|
||||
#include "extensions/browser/api/api_resource_manager.h"
|
||||
#include "extensions/browser/api/audio/audio_api.h"
|
||||
#include "extensions/browser/api/bluetooth/bluetooth_api.h"
|
||||
@ -38,7 +39,6 @@
|
||||
#include "extensions/browser/api/offscreen/offscreen_document_manager.h"
|
||||
#include "extensions/browser/api/power/power_api.h"
|
||||
#include "extensions/browser/api/printer_provider/printer_provider_api_factory.h"
|
||||
#include "extensions/browser/api/runtime/runtime_api.h"
|
||||
#include "extensions/browser/api/serial/serial_connection.h"
|
||||
#include "extensions/browser/api/serial/serial_port_manager.h"
|
||||
#include "extensions/browser/api/socket/socket.h"
|
||||
@ -69,7 +69,9 @@
|
||||
namespace extensions {
|
||||
|
||||
void EnsureApiBrowserContextKeyedServiceFactoriesBuilt() {
|
||||
AlarmManager::GetFactoryInstance();
|
||||
declarative_net_request::RulesMonitorService::GetFactoryInstance();
|
||||
RuntimeAPI::GetFactoryInstance();
|
||||
SessionStorageManager::GetFactory();
|
||||
StorageFrontend::GetFactoryInstance();
|
||||
WebRequestAPI::GetFactoryInstance();
|
||||
@ -78,7 +80,6 @@ void EnsureApiBrowserContextKeyedServiceFactoriesBuilt() {
|
||||
// The following are not supported in the experimental desktop-android build.
|
||||
// TODO(https://crbug.com/356905053): Enable these APIs on desktop-android.
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
AlarmManager::GetFactoryInstance();
|
||||
ApiResourceManager<BluetoothApiAdvertisement>::GetFactoryInstance();
|
||||
ApiResourceManager<BluetoothApiSocket>::GetFactoryInstance();
|
||||
ApiResourceManager<BluetoothLowEnergyConnection>::GetFactoryInstance();
|
||||
@ -124,7 +125,6 @@ void EnsureApiBrowserContextKeyedServiceFactoriesBuilt() {
|
||||
PowerAPI::GetFactoryInstance();
|
||||
PrinterProviderAPIFactory::GetInstance();
|
||||
RulesRegistryService::GetFactoryInstance();
|
||||
RuntimeAPI::GetFactoryInstance();
|
||||
SystemInfoAPI::GetFactoryInstance();
|
||||
UsbDeviceManager::GetFactoryInstance();
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
|
Reference in New Issue
Block a user