Split Cache: Adds frame origin while creating NetworkIsolationKey
This CL constructs the network isolation key using both top-frame-origin
and frame origin. The frame origin is also updated to be a
non-optional argument in the constructor. A follow-up CL will make
top frame origin also a non-optional argument.
Also, updating all of tests to include both parameters when calling
this function.
The new tests in this CL are scoped to Split Cache browser and unit tests
and API unit tests. Other consumers of Network Isolation Key like sockets
etc. will need follow up CLs for any additional tests.
(Initial patches of this CL were done by ericrobinson)
Bug: 950069
Change-Id: Ide1cf9d9f58a768cd22c4b667520a13abf88f9b2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1678551
Commit-Queue: Shivani Sharma <[email protected]>
Reviewed-by: Alex Moshchuk <[email protected]>
Reviewed-by: Matt Menke <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Josh Karlin <[email protected]>
Reviewed-by: Shivani Sharma <[email protected]>
Cr-Commit-Position: refs/heads/master@{#679435}
diff --git a/net/quic/quic_chromium_client_session_test.cc b/net/quic/quic_chromium_client_session_test.cc
index 42dcc6e..89a321d 100644
--- a/net/quic/quic_chromium_client_session_test.cc
+++ b/net/quic/quic_chromium_client_session_test.cc
@@ -260,6 +260,9 @@
::testing::Combine(::testing::ValuesIn(quic::AllSupportedVersions()),
::testing::Bool()));
+// TODO(950069): Add testing for frame_origin in NetworkIsolationKey using
+// kAppendInitiatingFrameOriginToNetworkIsolationKey.
+
TEST_P(QuicChromiumClientSessionTest, IsFatalErrorNotSetForNonFatalError) {
MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)};
std::unique_ptr<quic::QuicEncryptedPacket> settings_packet(
@@ -1343,14 +1346,16 @@
EXPECT_FALSE(session_->CanPool("mail.google.com", PRIVACY_MODE_DISABLED,
SocketTag(), NetworkIsolationKey()));
+ const auto kOriginFoo = url::Origin::Create(GURL("http://foo.test/"));
+
// Check that NetworkIsolationKey is respected when feature is enabled.
{
base::test::ScopedFeatureList feature_list;
feature_list.InitAndDisableFeature(
features::kPartitionConnectionsByNetworkIsolationKey);
- EXPECT_TRUE(session_->CanPool(
- "mail.example.com", PRIVACY_MODE_DISABLED, SocketTag(),
- NetworkIsolationKey(url::Origin::Create(GURL("http://foo.test/")))));
+ EXPECT_TRUE(session_->CanPool("mail.example.com", PRIVACY_MODE_DISABLED,
+ SocketTag(),
+ NetworkIsolationKey(kOriginFoo, kOriginFoo)));
}
{
base::test::ScopedFeatureList feature_list;
@@ -1358,7 +1363,7 @@
features::kPartitionConnectionsByNetworkIsolationKey);
EXPECT_FALSE(session_->CanPool(
"mail.example.com", PRIVACY_MODE_DISABLED, SocketTag(),
- NetworkIsolationKey(url::Origin::Create(GURL("http://foo.test/")))));
+ NetworkIsolationKey(kOriginFoo, kOriginFoo)));
}
}
@@ -1368,10 +1373,10 @@
feature_list.InitAndEnableFeature(
features::kPartitionConnectionsByNetworkIsolationKey);
- const NetworkIsolationKey kNetworkIsolationKey1(
- url::Origin::Create(GURL("http://foo.test/")));
- const NetworkIsolationKey kNetworkIsolationKey2(
- url::Origin::Create(GURL("http://bar.test/")));
+ const auto kOriginFoo = url::Origin::Create(GURL("http://foo.test/"));
+ const auto kOriginBar = url::Origin::Create(GURL("http://bar.test/"));
+ const NetworkIsolationKey kNetworkIsolationKey1(kOriginFoo, kOriginFoo);
+ const NetworkIsolationKey kNetworkIsolationKey2(kOriginBar, kOriginBar);
session_key_ =
QuicSessionKey(kServerHostname, kServerPort, PRIVACY_MODE_DISABLED,