chromium/components/safe_browsing/content/browser/password_protection/password_protection_commit_deferring_condition_unittest.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/safe_browsing/content/browser/password_protection/password_protection_commit_deferring_condition.h"

#include <memory>
#include <utility>
#include <vector>

#include "base/test/bind.h"
#include "components/safe_browsing/content/browser/password_protection/mock_password_protection_service.h"
#include "components/safe_browsing/content/browser/password_protection/password_protection_request_content.h"
#include "content/public/browser/commit_deferring_condition.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/mock_navigation_handle.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/test_renderer_host.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

namespace safe_browsing {

CommitDeferringCondition;
MockNavigationHandle;
NavigationHandle;
NavigationSimulator;
RenderViewHostTestHarness;
NiceMock;

class PasswordProtectionCommitDeferringConditionTest
    : public RenderViewHostTestHarness {};

// If created, and while not resumed, a condition must return kDefer to defer
// the navigation until safe browsing determines it should be resumed.
TEST_F(PasswordProtectionCommitDeferringConditionTest, DeferWhenCreated) {}

// If the password protection request is resolved before the navigation reaches
// commit, the condition shouldn't defer the navigation.
TEST_F(PasswordProtectionCommitDeferringConditionTest,
       ResumedBeforeCommitProceeds) {}

// Calling ResumeNavigation on a deferred condition should invoke the callback.
TEST_F(PasswordProtectionCommitDeferringConditionTest,
       InvokeCallbackFromResume) {}

}  // namespace safe_browsing