chromium/chrome/browser/safe_browsing/ohttp_key_service_factory_unittest.cc

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

#include "chrome/browser/safe_browsing/ohttp_key_service_factory.h"

#include "chrome/browser/safe_browsing/test_safe_browsing_service.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "components/safe_browsing/core/common/features.h"
#include "components/safe_browsing/core/common/hashprefix_realtime/hash_realtime_utils.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace safe_browsing {

class OhttpKeyServiceFactoryTest : public testing::Test {};

#if BUILDFLAG(IS_ANDROID)
TEST_F(OhttpKeyServiceFactoryTest, DisabledForRegularProfiles) {
  TestingProfile* profile = profile_manager_->CreateTestingProfile("profile");
  EXPECT_EQ(nullptr, OhttpKeyServiceFactory::GetForProfile(profile));
}
#else
TEST_F(OhttpKeyServiceFactoryTest, EnabledForRegularProfiles) {}

// Regression test requested in crbug.com/355577214.
TEST_F(OhttpKeyServiceFactoryTest,
       EnabledForRegularProfiles_HashRealTimeLookupsDisabled) {}

TEST_F(OhttpKeyServiceFactoryTest, DisabledForIncognitoMode) {}

TEST_F(OhttpKeyServiceFactoryTest, DisabledForGuestMode) {}
#endif

}  // namespace safe_browsing