0

serial: Enable serial_browsertest on Android

Bug: 396145433
Test: content_browsertest -f SerialTest*
Change-Id: I14414a3448baa4ce53d23afa0a1348d6652dfe72
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6405740
Reviewed-by: Jack Hsieh <chengweih@chromium.org>
Reviewed-by: Matt Reynolds <mattreynolds@chromium.org>
Commit-Queue: Garfield Tan <xutan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1439433}
This commit is contained in:
Garfield Tan
2025-03-28 08:26:19 -07:00
committed by Chromium LUCI CQ
parent 282c8fdc16
commit 51d398f49e
3 changed files with 17 additions and 1 deletions
content

@ -0,0 +1,3 @@
include_rules = [
"+device/base/features.h",
]

@ -7,6 +7,7 @@
#include "base/command_line.h"
#include "base/memory/raw_ptr.h"
#include "base/test/scoped_feature_list.h"
#include "base/unguessable_token.h"
#include "content/browser/serial/serial_test_utils.h"
#include "content/public/browser/content_browser_client.h"
@ -20,6 +21,7 @@
#include "content/public/test/content_browser_test_content_browser_client.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/shell/browser/shell.h"
#include "device/base/features.h"
#include "services/device/public/cpp/test/fake_serial_port_manager.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@ -47,6 +49,13 @@ class SerialTestShellContentBrowserClient
class SerialTest : public ContentBrowserTest {
public:
#if BUILDFLAG(IS_ANDROID)
SerialTest() {
scoped_feature_list_.InitAndEnableFeature(
device::features::kBluetoothRfcommAndroid);
}
#endif // BUILDFLAG(IS_ANDROID)
void SetUpCommandLine(base::CommandLine* command_line) override {
command_line->AppendSwitch(
switches::kEnableExperimentalWebPlatformFeatures);
@ -65,6 +74,10 @@ class SerialTest : public ContentBrowserTest {
private:
std::unique_ptr<SerialTestShellContentBrowserClient> test_client_;
device::FakeSerialPortManager port_manager_;
#if BUILDFLAG(IS_ANDROID)
base::test::ScopedFeatureList scoped_feature_list_;
#endif // BUILDFLAG(IS_ANDROID)
};
} // namespace

@ -1645,6 +1645,7 @@ test("content_browsertests") {
"../browser/security/coop/cross_origin_opener_policy_browsertest.cc",
"../browser/security/dip/document_isolation_policy_browsertest.cc",
"../browser/security_exploit_browsertest.cc",
"../browser/serial/serial_browsertest.cc",
"../browser/service_host/service_process_host_browsertest.cc",
"../browser/service_host/utility_process_host_browsertest.cc",
"../browser/service_worker/service_worker_auth_browsertest.cc",
@ -2196,7 +2197,6 @@ test("content_browsertests") {
"../browser/direct_sockets/direct_sockets_udp_browsertest.cc",
"../browser/font_preferences_browsertest.cc",
"../browser/renderer_host/clipboard_host_impl_browsertest.cc",
"../browser/serial/serial_browsertest.cc",
"../browser/speech/speech_recognition_browsertest.cc",
"../browser/speech/tts_ssml_browsertest.cc",
"../browser/storage_service_restart_browsertest.cc",