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 { ...@@ -46,6 +46,8 @@ class SmsBrowserTest : public ContentBrowserTest {
"SmsReceiver"); "SmsReceiver");
command_line->AppendSwitch( command_line->AppendSwitch(
switches::kEnableExperimentalWebPlatformFeatures); switches::kEnableExperimentalWebPlatformFeatures);
command_line->AppendSwitchASCII(switches::kWebOtpBackend,
switches::kWebOtpBackendSmsVerification);
cert_verifier_.SetUpCommandLine(command_line); cert_verifier_.SetUpCommandLine(command_line);
} }
......
...@@ -27,10 +27,11 @@ SmsProvider::~SmsProvider() = default; ...@@ -27,10 +27,11 @@ SmsProvider::~SmsProvider() = default;
std::unique_ptr<SmsProvider> SmsProvider::Create(RenderFrameHost* rfh) { std::unique_ptr<SmsProvider> SmsProvider::Create(RenderFrameHost* rfh) {
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kWebOtpBackend) == switches::kWebOtpBackendUserConsent) { switches::kWebOtpBackend) ==
return std::make_unique<SmsProviderGmsUserConsent>(rfh); switches::kWebOtpBackendSmsVerification) {
return std::make_unique<SmsProviderGmsVerification>();
} }
return std::make_unique<SmsProviderGmsVerification>(); return std::make_unique<SmsProviderGmsUserConsent>(rfh);
#else #else
return nullptr; return nullptr;
#endif #endif
......
...@@ -105,7 +105,8 @@ void SmsService::OnReceive(const std::string& one_time_code) { ...@@ -105,7 +105,8 @@ void SmsService::OnReceive(const std::string& one_time_code) {
one_time_code_ = one_time_code; one_time_code_ = one_time_code;
if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kWebOtpBackend) == switches::kWebOtpBackendUserConsent) { switches::kWebOtpBackend) !=
switches::kWebOtpBackendSmsVerification) {
Process(SmsStatus::kSuccess, one_time_code_); Process(SmsStatus::kSuccess, one_time_code_);
return; return;
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/run_loop.h" #include "base/run_loop.h"
...@@ -21,6 +22,7 @@ ...@@ -21,6 +22,7 @@
#include "content/browser/sms/test/mock_sms_web_contents_delegate.h" #include "content/browser/sms/test/mock_sms_web_contents_delegate.h"
#include "content/browser/web_contents/web_contents_impl.h" #include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/sms_fetcher.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/common/service_manager_connection.h"
#include "content/public/test/navigation_simulator.h" #include "content/public/test/navigation_simulator.h"
#include "content/public/test/test_browser_context.h" #include "content/public/test/test_browser_context.h"
...@@ -140,6 +142,12 @@ class SmsServiceTest : public RenderViewHostTestHarness { ...@@ -140,6 +142,12 @@ class SmsServiceTest : public RenderViewHostTestHarness {
SmsServiceTest() = default; SmsServiceTest() = default;
~SmsServiceTest() override = default; ~SmsServiceTest() override = default;
void SetUp() override {
RenderViewHostTestHarness::SetUp();
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
switches::kWebOtpBackend, switches::kWebOtpBackendSmsVerification);
}
void ExpectDestroyedReasonCount(SmsReceiverDestroyedReason bucket, void ExpectDestroyedReasonCount(SmsReceiverDestroyedReason bucket,
int32_t count) { int32_t count) {
histogram_tester_.ExpectBucketCount("Blink.Sms.Receive.DestroyedReason", 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