Commit ca145100 authored by Nick Harper's avatar Nick Harper Committed by Commit Bot

Remove features::kChannelID

Bug: 875053
Change-Id: I10e419f9e15d004d8da115ed9b18734d47b0a442
Reviewed-on: https://chromium-review.googlesource.com/c/1279294
Commit-Queue: Nick Harper <nharper@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarRyan Hamilton <rch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599800}
parent a47e8d6f
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/test/base/ui_test_utils.h" #include "chrome/test/base/ui_test_utils.h"
#include "components/crx_file/id_util.h" #include "components/crx_file/id_util.h"
#include "components/network_session_configurator/common/network_features.h"
#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_registrar.h"
...@@ -63,72 +62,13 @@ ...@@ -63,72 +62,13 @@
#include "extensions/test/extension_test_message_listener.h" #include "extensions/test/extension_test_message_listener.h"
#include "extensions/test/result_catcher.h" #include "extensions/test/result_catcher.h"
#include "extensions/test/test_extension_dir.h" #include "extensions/test/test_extension_dir.h"
#include "net/cert/asn1_util.h"
#include "net/cert/jwk_serializer.h"
#include "net/dns/mock_host_resolver.h" #include "net/dns/mock_host_resolver.h"
#include "net/ssl/channel_id_service.h"
#include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace extensions { namespace extensions {
namespace { namespace {
void GotDomainBoundCert(base::WaitableEvent* waitable_event, int status) {
ASSERT_EQ(net::OK, status);
waitable_event->Signal();
}
void CreateDomainBoundCertOnIOThread(
base::WaitableEvent* waitable_event,
std::unique_ptr<crypto::ECPrivateKey>* channel_id_key,
net::ChannelIDService::Request* request,
const GURL& url,
scoped_refptr<net::URLRequestContextGetter> request_context_getter) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
net::ChannelIDService* channel_id_service =
request_context_getter->GetURLRequestContext()->channel_id_service();
if (!channel_id_service) {
waitable_event->Signal();
return;
}
int status = channel_id_service->GetOrCreateChannelID(
url.host(), channel_id_key,
base::BindRepeating(&GotDomainBoundCert, waitable_event), request);
if (status == net::ERR_IO_PENDING)
return;
GotDomainBoundCert(waitable_event, status);
}
// Creates a TLS channel id for the given |url| for the request context
// retrieved from |request_context_getter|.
std::string CreateTlsChannelId(
scoped_refptr<net::URLRequestContextGetter> request_context_getter,
const GURL& url) {
std::unique_ptr<crypto::ECPrivateKey> channel_id_key;
net::ChannelIDService::Request request;
base::WaitableEvent waitable_event(
base::WaitableEvent::ResetPolicy::AUTOMATIC,
base::WaitableEvent::InitialState::NOT_SIGNALED);
base::PostTaskWithTraits(
FROM_HERE, {content::BrowserThread::IO},
base::BindOnce(&CreateDomainBoundCertOnIOThread, &waitable_event,
&channel_id_key, &request, url, request_context_getter));
waitable_event.Wait();
// Create the expected value.
std::vector<uint8_t> spki_vector;
if (!channel_id_key || !channel_id_key->ExportPublicKey(&spki_vector))
return std::string();
base::StringPiece spki(reinterpret_cast<char*>(spki_vector.data()),
spki_vector.size());
base::DictionaryValue jwk_value;
net::JwkSerializer::ConvertSpkiFromDerToJwk(spki, &jwk_value);
std::string tls_channel_id_value;
base::JSONWriter::Write(jwk_value, &tls_channel_id_value);
return tls_channel_id_value;
}
class MessageSender : public content::NotificationObserver { class MessageSender : public content::NotificationObserver {
public: public:
MessageSender() { MessageSender() {
...@@ -1147,13 +1087,8 @@ IN_PROC_BROWSER_TEST_P(ExternallyConnectableMessagingTest, FromPopup) { ...@@ -1147,13 +1087,8 @@ IN_PROC_BROWSER_TEST_P(ExternallyConnectableMessagingTest, FromPopup) {
// that can connect to it, with a TLS channel ID having been generated. // that can connect to it, with a TLS channel ID having been generated.
IN_PROC_BROWSER_TEST_P(ExternallyConnectableMessagingTest, IN_PROC_BROWSER_TEST_P(ExternallyConnectableMessagingTest,
WebConnectableWithNonEmptyTlsChannelId) { WebConnectableWithNonEmptyTlsChannelId) {
std::string expected_tls_channel_id_value = std::string expected_tls_channel_id_value;
CreateTlsChannelId(profile()->GetRequestContext(), chromium_org_url()); bool expect_empty_id = true;
bool expect_empty_id = false;
if (!base::FeatureList::IsEnabled(::features::kChannelID)) {
expected_tls_channel_id_value = "";
expect_empty_id = true;
}
scoped_refptr<const Extension> chromium_connectable = scoped_refptr<const Extension> chromium_connectable =
LoadChromiumConnectableExtensionWithTlsChannelId(); LoadChromiumConnectableExtensionWithTlsChannelId();
...@@ -1211,7 +1146,6 @@ class ExternallyConnectableMessagingTestNoChannelID ...@@ -1211,7 +1146,6 @@ class ExternallyConnectableMessagingTestNoChannelID
~ExternallyConnectableMessagingTestNoChannelID() override {} ~ExternallyConnectableMessagingTestNoChannelID() override {}
void SetUpCommandLine(base::CommandLine* command_line) override { void SetUpCommandLine(base::CommandLine* command_line) override {
scoped_feature_list_.InitAndDisableFeature(::features::kChannelID);
ExternallyConnectableMessagingTest::SetUpCommandLine(command_line); ExternallyConnectableMessagingTest::SetUpCommandLine(command_line);
} }
...@@ -1223,8 +1157,7 @@ class ExternallyConnectableMessagingTestNoChannelID ...@@ -1223,8 +1157,7 @@ class ExternallyConnectableMessagingTestNoChannelID
IN_PROC_BROWSER_TEST_P(ExternallyConnectableMessagingTestNoChannelID, IN_PROC_BROWSER_TEST_P(ExternallyConnectableMessagingTestNoChannelID,
TlsChannelIdEmptyWhenDisabled) { TlsChannelIdEmptyWhenDisabled) {
std::string expected_tls_channel_id_value = std::string expected_tls_channel_id_value;
CreateTlsChannelId(profile()->GetRequestContext(), chromium_org_url());
scoped_refptr<const Extension> chromium_connectable = scoped_refptr<const Extension> chromium_connectable =
LoadChromiumConnectableExtensionWithTlsChannelId(); LoadChromiumConnectableExtensionWithTlsChannelId();
...@@ -1255,8 +1188,7 @@ INSTANTIATE_TEST_CASE_P(JavaScriptBindingsNoChannelID, ...@@ -1255,8 +1188,7 @@ INSTANTIATE_TEST_CASE_P(JavaScriptBindingsNoChannelID,
IN_PROC_BROWSER_TEST_P( IN_PROC_BROWSER_TEST_P(
ExternallyConnectableMessagingTest, ExternallyConnectableMessagingTest,
DISABLED_WebConnectableWithNonEmptyTlsChannelIdAndClosedBackgroundPage) { DISABLED_WebConnectableWithNonEmptyTlsChannelIdAndClosedBackgroundPage) {
std::string expected_tls_channel_id_value = std::string expected_tls_channel_id_value;
CreateTlsChannelId(profile()->GetRequestContext(), chromium_org_url());
scoped_refptr<const Extension> chromium_connectable = scoped_refptr<const Extension> chromium_connectable =
LoadChromiumConnectableExtensionWithTlsChannelId(); LoadChromiumConnectableExtensionWithTlsChannelId();
...@@ -1467,12 +1399,8 @@ IN_PROC_BROWSER_TEST_P(MessagingApiTest, ...@@ -1467,12 +1399,8 @@ IN_PROC_BROWSER_TEST_P(MessagingApiTest,
// Add a TLS channel id for the app's origin in the app's storage partition. // Add a TLS channel id for the app's origin in the app's storage partition.
GURL background_url = platform_app->GetResourceURL("background.js"); GURL background_url = platform_app->GetResourceURL("background.js");
std::string tls_channel_id = CreateTlsChannelId( std::string tls_channel_id("undefined");
app_storage_partition->GetURLRequestContext(), background_url);
ASSERT_FALSE(tls_channel_id.empty()); ASSERT_FALSE(tls_channel_id.empty());
if (!base::FeatureList::IsEnabled(::features::kChannelID)) {
tls_channel_id = "undefined";
}
// Load up an extension that the app can message, which we will use to // Load up an extension that the app can message, which we will use to
// verify the TLS channel id sent to the message listener. // verify the TLS channel id sent to the message listener.
......
...@@ -639,9 +639,6 @@ void ParseCommandLineAndFieldTrials(const base::CommandLine& command_line, ...@@ -639,9 +639,6 @@ void ParseCommandLineAndFieldTrials(const base::CommandLine& command_line,
params->host_mapping_rules.SetRulesFromString( params->host_mapping_rules.SetRulesFromString(
command_line.GetSwitchValueASCII(switches::kHostRules)); command_line.GetSwitchValueASCII(switches::kHostRules));
} }
params->enable_channel_id =
base::FeatureList::IsEnabled(features::kChannelID);
} }
net::URLRequestContextBuilder::HttpCacheParams::Type ChooseCacheType( net::URLRequestContextBuilder::HttpCacheParams::Type ChooseCacheType(
......
...@@ -734,26 +734,6 @@ TEST_F(NetworkSessionConfiguratorTest, HostRules) { ...@@ -734,26 +734,6 @@ TEST_F(NetworkSessionConfiguratorTest, HostRules) {
EXPECT_EQ("foo", host_port_pair.host()); EXPECT_EQ("foo", host_port_pair.host());
} }
TEST_F(NetworkSessionConfiguratorTest, ChannelIDEnabled) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(features::kChannelID);
base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
ParseCommandLineAndFieldTrials(command_line);
EXPECT_TRUE(params_.enable_channel_id);
}
TEST_F(NetworkSessionConfiguratorTest, ChannelIDDisabled) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndDisableFeature(features::kChannelID);
base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
ParseCommandLineAndFieldTrials(command_line);
EXPECT_FALSE(params_.enable_channel_id);
}
TEST_F(NetworkSessionConfiguratorTest, DefaultCacheBackend) { TEST_F(NetworkSessionConfiguratorTest, DefaultCacheBackend) {
base::CommandLine command_line(base::CommandLine::NO_PROGRAM); base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) #if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS)
......
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
namespace features { namespace features {
const base::Feature kChannelID{"channel-id", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kDnsOverHttps{"dns-over-https", const base::Feature kDnsOverHttps{"dns-over-https",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
......
...@@ -10,9 +10,6 @@ ...@@ -10,9 +10,6 @@
namespace features { namespace features {
// Enables Channel ID.
NETWORK_SESSION_CONFIGURATOR_EXPORT extern const base::Feature kChannelID;
// Enabled DNS over HTTPS // Enabled DNS over HTTPS
// (https://tools.ietf.org/id/draft-ietf-doh-dns-over-https-12.txt). // (https://tools.ietf.org/id/draft-ietf-doh-dns-over-https-12.txt).
NETWORK_SESSION_CONFIGURATOR_EXPORT extern const base::Feature kDnsOverHttps; NETWORK_SESSION_CONFIGURATOR_EXPORT extern const base::Feature kDnsOverHttps;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment