#include "content/browser/sms/webotp_service.h"
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "components/ukm/test_ukm_recorder.h"
#include "content/browser/sms/sms_fetcher_impl.h"
#include "content/browser/sms/test/mock_sms_provider.h"
#include "content/browser/sms/test/mock_sms_web_contents_delegate.h"
#include "content/browser/sms/test/mock_user_consent_handler.h"
#include "content/browser/sms/user_consent_handler.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/test/navigation_simulator.h"
#include "content/public/test/test_browser_context.h"
#include "content/public/test/test_renderer_host.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/test_support/test_utils.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/service_manager/public/cpp/bind_source_info.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/sms/webotp_service_outcome.h"
#include "third_party/blink/public/mojom/sms/webotp_service.mojom-shared.h"
#include "third_party/blink/public/mojom/sms/webotp_service.mojom.h"
BindLambdaForTesting;
SmsStatus;
WebOTPService;
optional;
string;
_;
ByMove;
Invoke;
NiceMock;
Return;
StrictMock;
Origin;
namespace content {
class RenderFrameHost;
Entry;
FailureType;
UserConsent;
namespace {
const char kTestUrl[] = …;
class StubWebContentsDelegate : public WebContentsDelegate { … };
class Service { … };
class WebOTPServiceTest : public RenderViewHostTestHarness { … };
}
TEST_F(WebOTPServiceTest, Basic) { … }
TEST_F(WebOTPServiceTest, HandlesMultipleCalls) { … }
TEST_F(WebOTPServiceTest, IgnoreFromOtherOrigins) { … }
TEST_F(WebOTPServiceTest, ExpectOneReceiveTwo) { … }
TEST_F(WebOTPServiceTest, AtMostOneSmsRequestPerOrigin) { … }
TEST_F(WebOTPServiceTest, CleansUp) { … }
TEST_F(WebOTPServiceTest, Abort) { … }
class ServiceWithPrompt : public Service { … };
TEST_F(WebOTPServiceTest, SecondRequestDuringPrompt) { … }
TEST_F(WebOTPServiceTest, AbortWhilePrompt) { … }
TEST_F(WebOTPServiceTest, RequestAfterAbortWhilePrompt) { … }
TEST_F(WebOTPServiceTest, SecondRequestWhilePrompt) { … }
TEST_F(WebOTPServiceTest, RecordTimeMetricsForContinueOnSuccess) { … }
TEST_F(WebOTPServiceTest, RecordMetricsForCancelOnSuccess) { … }
TEST_F(WebOTPServiceTest, RecordTimeoutAsOutcomeWithoutFailure) { … }
TEST_F(WebOTPServiceTest, RecordTimeoutAsOutcomeWithTimerActivation) { … }
TEST_F(WebOTPServiceTest, NotRecordTimeoutAsOutcomeWithoutTimerActivation) { … }
TEST_F(WebOTPServiceTest, RecordTimeoutAsOutcomeUponPreviousRequestCancelled) { … }
TEST_F(WebOTPServiceTest, RecordTimeoutAsOutcomeUponDestruction) { … }
TEST_F(WebOTPServiceTest, RecordUserCancelledAsOutcome) { … }
TEST_F(WebOTPServiceTest,
NotRecordUserCancelledAsOutcomeWithoutTimerActivation) { … }
TEST_F(WebOTPServiceTest,
RecordUserCancelledAsOutcomeUponPreviousRequestCancelled) { … }
TEST_F(WebOTPServiceTest, RecordUserCancelledAsOutcomeUponDestruction) { … }
TEST_F(WebOTPServiceTest, RecordUserDismissPrompt) { … }
TEST_F(WebOTPServiceTest, RecordUnhandledRequestOnNavigation) { … }
TEST_F(WebOTPServiceTest, NotRecordUnhandledRequestWhenThereIsNoRequest) { … }
TEST_F(WebOTPServiceTest, NotRecordUnhandledRequestWhenRequestIsHandled) { … }
TEST_F(WebOTPServiceTest, RecordWebContentsVisibilityForUserConsentAPI) { … }
TEST_F(WebOTPServiceTest, RecordCancelledAsOutcome) { … }
TEST_F(WebOTPServiceTest,
RecordCrossDeviceFailureAsOutcomeUponPreviousRequestCancelled) { … }
TEST_F(WebOTPServiceTest, RecordCrossDeviceFailureAsOutcomeUponDestruction) { … }
}