net/http/transport_security_persister_unittest.cc
// Tests that Expect-CT state is not serialized and persisted when the feature
// is disabled.
Tests that Expect-CT state is not serialized and persisted when the feature
is disabled.
Tests that Expect - CT state is not serialized and persisted when the feature is disabled .
TEST_F(TransportSecurityPersisterTest, ExpectCTDisabled) {
  base::test::ScopedFeatureList feature_list;
  feature_list.InitAndDisableFeature(
      TransportSecurityState::kDynamicExpectCTFeature);
  const GURL report_uri(kReportUri);
  TransportSecurityState::ExpectCTState expect_ct_state;
  static const char kTestDomain[] = "example.test";
  EXPECT_FALSE(state_.GetDynamicExpectCTState(kTestDomain, &expect_ct_state));
  const base::Time current_time(base::Time::Now());
  const base::Time expiry = current_time + base::TimeDelta::FromSeconds(1000);
  state_.AddExpectCT(kTestDomain, expiry, true , GURL());
  std::string serialized;
  EXPECT_TRUE(persister_->SerializeData(&serialized));
  bool dirty;
  EXPECT_TRUE(persister_->LoadEntries(serialized, &dirty));
  TransportSecurityState::ExpectCTState new_expect_ct_state;
  EXPECT_FALSE(
      state_.GetDynamicExpectCTState(kTestDomain, &new_expect_ct_state));
}
TEST_F ( TransportSecurityPersisterTest , ExpectCTDisabled ) { base :: test :: ScopedFeatureList feature_list ; feature_list . InitAndDisableFeature ( TransportSecurityState :: kDynamicExpectCTFeature ) ; const GURL report_uri ( kReportUri ) ; TransportSecurityState :: ExpectCTState expect_ct_state ; static const char kTestDomain [ ] = " " ; EXPECT_FALSE ( state_ . GetDynamicExpectCTState ( kTestDomain , & expect_ct_state ) ) ; const base :: Time current_time ( base :: Time :: Now ( ) ) ; const base :: Time expiry = current_time + base :: TimeDelta :: FromSeconds ( 1000 ) ; state_ . AddExpectCT ( kTestDomain , expiry , true , GURL ( ) ) ; std :: string serialized ; EXPECT_TRUE ( persister_ -> SerializeData ( & serialized ) ) ; bool dirty ; EXPECT_TRUE ( persister_ -> LoadEntries ( serialized , & dirty ) ) ; TransportSecurityState :: ExpectCTState new_expect_ct_state ; EXPECT_FALSE ( state_ . GetDynamicExpectCTState ( kTestDomain , & new_expect_ct_state ) ) ; }
Tests that Expect-CT state is not serialized and persisted when the feature
is disabled.
Tests that Expect - CT state is not serialized and persisted when the feature is disabled .
/* enforce */