Commit 732cb058 authored by Ayu Ishii's avatar Ayu Ishii Committed by Commit Bot

WebOTP: Change default backend to be User Consent API

Change-Id: I7b7e2c0717bc20f913fba1577d34839bdecc16e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2116011
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#752672}
parent 3804fbc2
......@@ -46,6 +46,8 @@ class SmsBrowserTest : public ContentBrowserTest {
"SmsReceiver");
command_line->AppendSwitch(
switches::kEnableExperimentalWebPlatformFeatures);
command_line->AppendSwitchASCII(switches::kWebOtpBackend,
switches::kWebOtpBackendSmsVerification);
cert_verifier_.SetUpCommandLine(command_line);
}
......
......@@ -27,10 +27,11 @@ SmsProvider::~SmsProvider() = default;
std::unique_ptr<SmsProvider> SmsProvider::Create(RenderFrameHost* rfh) {
#if defined(OS_ANDROID)
if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kWebOtpBackend) == switches::kWebOtpBackendUserConsent) {
return std::make_unique<SmsProviderGmsUserConsent>(rfh);
switches::kWebOtpBackend) ==
switches::kWebOtpBackendSmsVerification) {
return std::make_unique<SmsProviderGmsVerification>();
}
return std::make_unique<SmsProviderGmsVerification>();
return std::make_unique<SmsProviderGmsUserConsent>(rfh);
#else
return nullptr;
#endif
......
......@@ -105,7 +105,8 @@ void SmsService::OnReceive(const std::string& one_time_code) {
one_time_code_ = one_time_code;
if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kWebOtpBackend) == switches::kWebOtpBackendUserConsent) {
switches::kWebOtpBackend) !=
switches::kWebOtpBackendSmsVerification) {
Process(SmsStatus::kSuccess, one_time_code_);
return;
}
......
......@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
#include "base/run_loop.h"
......@@ -21,6 +22,7 @@
#include "content/browser/sms/test/mock_sms_web_contents_delegate.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/sms_fetcher.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/service_manager_connection.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/test_browser_context.h"
......@@ -140,6 +142,12 @@ class SmsServiceTest : public RenderViewHostTestHarness {
SmsServiceTest() = default;
~SmsServiceTest() override = default;
void SetUp() override {
RenderViewHostTestHarness::SetUp();
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
switches::kWebOtpBackend, switches::kWebOtpBackendSmsVerification);
}
void ExpectDestroyedReasonCount(SmsReceiverDestroyedReason bucket,
int32_t count) {
histogram_tester_.ExpectBucketCount("Blink.Sms.Receive.DestroyedReason",
......
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