From 17a6bd69fac89467d7363b0b67c7204e16de08b0 Mon Sep 17 00:00:00 2001 From: jeffreyliu Date: Thu, 19 Oct 2023 16:26:31 +0800 Subject: [PATCH] [TicketNo:]SR20230811922333 Signed-off-by: jeffreyliu Change-Id: Id7e988bb53cf4c7f2b4634118f1f04dff15aab84 --- BUILD.gn | 4 ++++ content/public/test/fake_local_frame.cc | 1 + content/shell/browser/shell_content_browser_client.cc | 6 ++++-- content/shell/browser/shell_content_browser_client.h | 5 +++-- content/shell/browser/shell_paths.cc | 4 ++++ extensions/BUILD.gn | 4 ++++ extensions/shell/BUILD.gn | 4 ++++ gpu/BUILD.gn | 1 + headless/lib/browser/headless_content_browser_client.cc | 3 ++- headless/lib/browser/headless_content_browser_client.h | 2 +- headless/lib/headless_content_main_delegate.cc | 4 ++-- media/audio/BUILD.gn | 1 + media/audio/audio_output_proxy_unittest.cc | 4 +++- media/mojo/BUILD.gn | 1 + ui/snapshot/BUILD.gn | 4 ++++ 15 files changed, 39 insertions(+), 9 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index f5ed2ffbfc..7531ae5c7d 100755 --- a/BUILD.gn +++ b/BUILD.gn @@ -839,6 +839,10 @@ group("gn_all") { ] } + if (is_ohos){ + deps += [ "//headless:headless_tests" ] + } + if (enable_vr) { deps += [ "//chrome/browser/vr:vr_common_perftests", diff --git a/content/public/test/fake_local_frame.cc b/content/public/test/fake_local_frame.cc index eddd1dfbd5..b3a25b3885 100755 --- a/content/public/test/fake_local_frame.cc +++ b/content/public/test/fake_local_frame.cc @@ -193,6 +193,7 @@ void FakeLocalFrame::HandleRendererDebugURL(const GURL& url) {} void FakeLocalFrame::GetCanonicalUrlForSharing( base::OnceCallback&)> callback) {} + void FakeLocalFrame::BindFrameHostReceiver( mojo::ScopedInterfaceEndpointHandle handle) { receiver_.Bind(mojo::PendingAssociatedReceiver( diff --git a/content/shell/browser/shell_content_browser_client.cc b/content/shell/browser/shell_content_browser_client.cc index 932bc7aa38..3c3bae8207 100644 --- a/content/shell/browser/shell_content_browser_client.cc +++ b/content/shell/browser/shell_content_browser_client.cc @@ -88,7 +88,7 @@ #include "services/device/public/cpp/test/fake_geolocation_manager.h" #endif -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_OHOS) #include "components/crash/core/app/crash_switches.h" #include "components/crash/core/app/crashpad.h" #include "content/public/common/content_descriptors.h" @@ -522,7 +522,8 @@ void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess( #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || // BUILDFLAG(IS_ANDROID) -void ShellContentBrowserClient::ConfigureNetworkContextParams( +// return True for OH UT +bool ShellContentBrowserClient::ConfigureNetworkContextParams( BrowserContext* context, bool in_memory, const base::FilePath& relative_partition_path, @@ -531,6 +532,7 @@ void ShellContentBrowserClient::ConfigureNetworkContextParams( cert_verifier_creation_params) { ConfigureNetworkContextParamsForShell(context, network_context_params, cert_verifier_creation_params); + return true; } std::vector diff --git a/content/shell/browser/shell_content_browser_client.h b/content/shell/browser/shell_content_browser_client.h index 6e61db235f..1ed89fd12b 100644 --- a/content/shell/browser/shell_content_browser_client.h +++ b/content/shell/browser/shell_content_browser_client.h @@ -104,7 +104,8 @@ class ShellContentBrowserClient : public ContentBrowserClient { const url::Origin& origin, bool is_for_isolated_world, network::mojom::URLLoaderFactoryParams* factory_params) override; -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \ + BUILDFLAG(IS_OHOS) void GetAdditionalMappedFilesForChildProcess( const base::CommandLine& command_line, int child_process_id, @@ -112,7 +113,7 @@ class ShellContentBrowserClient : public ContentBrowserClient { #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || // BUILDFLAG(IS_ANDROID) device::GeolocationManager* GetGeolocationManager() override; - void ConfigureNetworkContextParams( + bool ConfigureNetworkContextParams( BrowserContext* context, bool in_memory, const base::FilePath& relative_partition_path, diff --git a/content/shell/browser/shell_paths.cc b/content/shell/browser/shell_paths.cc index ac3964260f..4a048833a7 100644 --- a/content/shell/browser/shell_paths.cc +++ b/content/shell/browser/shell_paths.cc @@ -39,6 +39,10 @@ bool GetDefaultUserDataDirectory(base::FilePath* result) { #elif BUILDFLAG(IS_FUCHSIA) *result = base::FilePath(base::kPersistedDataDirectoryPath) .Append(FILE_PATH_LITERAL("content_shell")); +#elif BUILDFLAG(IS_OHOS) + CHECK(base::PathService::Get(base::DIR_OHOS_APP_DATA, result)); + //Not Sure if DIR_OHOS_APP_DATA is OK or not + *result = result->Append(FILE_PATH_LITERAL("content_shell")); #else NOTIMPLEMENTED(); return false; diff --git a/extensions/BUILD.gn b/extensions/BUILD.gn index 53ddd25c2f..237ea58149 100644 --- a/extensions/BUILD.gn +++ b/extensions/BUILD.gn @@ -288,6 +288,10 @@ if (enable_extensions) { "//build/config/fuchsia/test/network_capabilities.test-cmx", ] } + + if (is_ohos){ + deps += [ "//cef:libcef_static" ] + } } test("extensions_browsertests") { diff --git a/extensions/shell/BUILD.gn b/extensions/shell/BUILD.gn index ca5f16ea11..8061d7fcbb 100644 --- a/extensions/shell/BUILD.gn +++ b/extensions/shell/BUILD.gn @@ -363,6 +363,10 @@ test("app_shell_unittests") { "//chromeos/dbus/power", ] } + + if (is_ohos){ + deps += [ "//cef:libcef_static" ] + } if (enable_nacl) { sources += [ "browser/shell_nacl_browser_delegate_unittest.cc" ] diff --git a/gpu/BUILD.gn b/gpu/BUILD.gn index 2b5a5b296a..86ee0499b1 100644 --- a/gpu/BUILD.gn +++ b/gpu/BUILD.gn @@ -668,6 +668,7 @@ test("gpu_unittests") { "//gpu/command_buffer/common:gles2_utils", "//gpu/command_buffer/service", "//gpu/config", + "//content/public/common:common", "//gpu/ipc:gl_in_process_context", "//gpu/ipc/client", "//gpu/ipc/common", diff --git a/headless/lib/browser/headless_content_browser_client.cc b/headless/lib/browser/headless_content_browser_client.cc index 90cd180937..f2ddabb1fc 100644 --- a/headless/lib/browser/headless_content_browser_client.cc +++ b/headless/lib/browser/headless_content_browser_client.cc @@ -323,7 +323,7 @@ bool HeadlessContentBrowserClient::ShouldEnableStrictSiteIsolation() { return browser_->options()->site_per_process; } -void HeadlessContentBrowserClient::ConfigureNetworkContextParams( +bool HeadlessContentBrowserClient::ConfigureNetworkContextParams( content::BrowserContext* context, bool in_memory, const base::FilePath& relative_partition_path, @@ -333,6 +333,7 @@ void HeadlessContentBrowserClient::ConfigureNetworkContextParams( HeadlessBrowserContextImpl::From(context)->ConfigureNetworkContextParams( in_memory, relative_partition_path, network_context_params, cert_verifier_creation_params); + return true; } std::string HeadlessContentBrowserClient::GetProduct() { diff --git a/headless/lib/browser/headless_content_browser_client.h b/headless/lib/browser/headless_content_browser_client.h index 4311b94631..fb5c56a236 100644 --- a/headless/lib/browser/headless_content_browser_client.h +++ b/headless/lib/browser/headless_content_browser_client.h @@ -73,7 +73,7 @@ class HeadlessContentBrowserClient : public content::ContentBrowserClient { std::unique_ptr delegate) override; bool ShouldEnableStrictSiteIsolation() override; - void ConfigureNetworkContextParams( + bool ConfigureNetworkContextParams( content::BrowserContext* context, bool in_memory, const base::FilePath& relative_partition_path, diff --git a/headless/lib/headless_content_main_delegate.cc b/headless/lib/headless_content_main_delegate.cc index dda176f2dd..5699f90426 100644 --- a/headless/lib/headless_content_main_delegate.cc +++ b/headless/lib/headless_content_main_delegate.cc @@ -47,9 +47,9 @@ #include "headless/embedded_resource_pak.h" #endif -#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OHOS) #include "components/crash/core/app/crashpad.h" -#endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OHOS) #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) #include "components/crash/core/app/crash_switches.h" diff --git a/media/audio/BUILD.gn b/media/audio/BUILD.gn index 76532d372c..3a67cd761f 100644 --- a/media/audio/BUILD.gn +++ b/media/audio/BUILD.gn @@ -429,6 +429,7 @@ source_set("unit_tests") { "//testing/gtest", "//third_party/opus:opus", "//url", + "//content/public/browser:browser", ] configs += [ diff --git a/media/audio/audio_output_proxy_unittest.cc b/media/audio/audio_output_proxy_unittest.cc index 58ff35441a..fb76be56f3 100644 --- a/media/audio/audio_output_proxy_unittest.cc +++ b/media/audio/audio_output_proxy_unittest.cc @@ -145,6 +145,8 @@ class MockAudioManager : public AudioManagerBase { void(media::AudioDeviceNames* device_name)); MOCK_METHOD2(GetPreferredOutputStreamParameters, AudioParameters( const std::string& device_id, const AudioParameters& params)); + MOCK_METHOD1(GetPreferredInputStreamParameters,AudioParameters( + const std::string& device_id)); private: media::FakeAudioLogFactory fake_audio_log_factory_; @@ -412,7 +414,7 @@ class AudioOutputProxyTest : public testing::Test { // |stream| is closed at this point. Start() should reopen it again. EXPECT_CALL(manager(), MakeAudioOutputStream(_, _, _)) .Times(2) - .WillRepeatedly(Return(reinterpret_cast(NULL))); + .WillRepeatedly(Return(static_cast(NULL))); EXPECT_CALL(callback_, OnError(_)).Times(2); diff --git a/media/mojo/BUILD.gn b/media/mojo/BUILD.gn index 636a7349f5..0ef4f6b6de 100644 --- a/media/mojo/BUILD.gn +++ b/media/mojo/BUILD.gn @@ -76,6 +76,7 @@ source_set("unit_tests") { "//media/mojo/mojom:unit_tests", "//media/mojo/services:unit_tests", "//media/mojo/test:unit_tests", + "//content/public/browser:browser", ] } diff --git a/ui/snapshot/BUILD.gn b/ui/snapshot/BUILD.gn index 22e747c9ef..d2bc3ab986 100644 --- a/ui/snapshot/BUILD.gn +++ b/ui/snapshot/BUILD.gn @@ -118,6 +118,10 @@ test("snapshot_unittests") { ] } + if (is_ohos) { + deps += [ "//cef:libcef_static" ] + } + if (is_fuchsia) { additional_manifest_fragments = [ # TODO(crbug.com/1185811): Figure out why jit_capabilities is needed. -- Gitee