#include "components/security_interstitials/content/stateful_ssl_host_state_delegate.h"
#include <stdint.h>
#include <utility>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/simple_test_clock.h"
#include "build/build_config.h"
#include "chrome/browser/browsing_data/chrome_browsing_data_remover_constants.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/extensions/chrome_test_extension_loader.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ssl/stateful_ssl_host_state_delegate_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/browsing_data/core/browsing_data_utils.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings_pattern.h"
#include "components/guest_view/browser/guest_view_base.h"
#include "components/guest_view/browser/test_guest_view_manager.h"
#include "content/public/browser/browsing_data_remover.h"
#include "content/public/browser/ssl_host_state_delegate.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/browsing_data_remover_test_util.h"
#include "extensions/browser/app_window/app_window.h"
#include "extensions/browser/app_window/app_window_registry.h"
#include "extensions/common/switches.h"
#include "net/test/cert_test_util.h"
#include "net/test/test_data_directory.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
const char kOkCertFile[] = …;
const char kWWWGoogleHost[] = …;
const char kGoogleHost[] = …;
const char kExampleHost[] = …;
const uint64_t kDeltaOneDayInSeconds = …86400);
const uint64_t kDeltaOneWeekInSeconds = …604800);
const uint64_t kDeltaFifteenDaysInSeconds = …1296000);
scoped_refptr<net::X509Certificate> GetOkCert() { … }
bool CStrStringMatcher(const char* a, const std::string& b) { … }
}
class StatefulSSLHostStateDelegateTest : public InProcessBrowserTest { … };
IN_PROC_BROWSER_TEST_F(StatefulSSLHostStateDelegateTest, QueryPolicy) { … }
IN_PROC_BROWSER_TEST_F(StatefulSSLHostStateDelegateTest,
HasAllowExceptionForAnyHost) { … }
IN_PROC_BROWSER_TEST_F(StatefulSSLHostStateDelegateTest, HttpAllowlisting) { … }
IN_PROC_BROWSER_TEST_F(StatefulSSLHostStateDelegateTest, HasPolicyAndRevoke) { … }
IN_PROC_BROWSER_TEST_F(StatefulSSLHostStateDelegateTest, Clear) { … }
IN_PROC_BROWSER_TEST_F(StatefulSSLHostStateDelegateTest,
DidHostRunInsecureContent) { … }
IN_PROC_BROWSER_TEST_F(StatefulSSLHostStateDelegateTest,
HasSeenRecurrentErrors) { … }
IN_PROC_BROWSER_TEST_F(StatefulSSLHostStateDelegateTest,
HasSeenRecurrentErrorsPref) { … }
IN_PROC_BROWSER_TEST_F(StatefulSSLHostStateDelegateTest,
HasSeenRecurrentErrorsPrefClockGoesBackwards) { … }
IN_PROC_BROWSER_TEST_F(StatefulSSLHostStateDelegateTest,
HasSeenRecurrentErrorsPrefErrorsInPast) { … }
class IncognitoSSLHostStateDelegateTest
: public StatefulSSLHostStateDelegateTest { … };
IN_PROC_BROWSER_TEST_F(IncognitoSSLHostStateDelegateTest, PRE_AfterRestart) { … }
IN_PROC_BROWSER_TEST_F(IncognitoSSLHostStateDelegateTest, AfterRestart) { … }
IN_PROC_BROWSER_TEST_F(IncognitoSSLHostStateDelegateTest,
DISABLED_PRE_AfterRestartHttp) { … }
IN_PROC_BROWSER_TEST_F(IncognitoSSLHostStateDelegateTest,
DISABLED_AfterRestartHttp) { … }
class DefaultMemorySSLHostStateDelegateTest
: public StatefulSSLHostStateDelegateTest { … };
IN_PROC_BROWSER_TEST_F(DefaultMemorySSLHostStateDelegateTest,
PRE_AfterRestart) { … }
IN_PROC_BROWSER_TEST_F(DefaultMemorySSLHostStateDelegateTest, AfterRestart) { … }
IN_PROC_BROWSER_TEST_F(DefaultMemorySSLHostStateDelegateTest,
PRE_AfterRestartHttp) { … }
IN_PROC_BROWSER_TEST_F(DefaultMemorySSLHostStateDelegateTest,
AfterRestartHttp) { … }
IN_PROC_BROWSER_TEST_F(DefaultMemorySSLHostStateDelegateTest,
QueryPolicyExpired) { … }
IN_PROC_BROWSER_TEST_F(DefaultMemorySSLHostStateDelegateTest,
HttpDecisionExpires) { … }
class RemoveBrowsingHistorySSLHostStateDelegateTest
: public StatefulSSLHostStateDelegateTest { … };
IN_PROC_BROWSER_TEST_F(RemoveBrowsingHistorySSLHostStateDelegateTest,
DeleteHistory) { … }
IN_PROC_BROWSER_TEST_F(RemoveBrowsingHistorySSLHostStateDelegateTest,
DeleteHistoryClearsHttpAllowlistDecision) { … }
IN_PROC_BROWSER_TEST_F(StatefulSSLHostStateDelegateTest,
LocalhostErrorWithoutFlag) { … }
class StatefulSSLHostStateDelegateExtensionTest
: public extensions::ExtensionBrowserTest { … };
IN_PROC_BROWSER_TEST_F(StatefulSSLHostStateDelegateExtensionTest,
StoragePartitionIsolation) { … }
IN_PROC_BROWSER_TEST_F(StatefulSSLHostStateDelegateExtensionTest,
StoragePartitionIsolationHttp) { … }