Commit 28cb9334 authored by Reid Kleckner's avatar Reid Kleckner Committed by Commit Bot

Revert "Check that Channel ID is in use before providing Channel IDs to extensions"

This reverts commit 646faed8.

Reason for revert: These tests fail in official build configurations:
https://uberchromegw.corp.google.com/i/official.desktop.continuous/builders/win%20trunk/builds/84233

Original change's description:
> Check that Channel ID is in use before providing Channel IDs to extensions
> 
> Change-Id: Iabe9977651ec3e38f43d2495e790af508a43e0e5
> Reviewed-on: https://chromium-review.googlesource.com/1055676
> Commit-Queue: Nick Harper <nharper@chromium.org>
> Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#558096}

TBR=rdevlin.cronin@chromium.org,nharper@chromium.org

Change-Id: I4f0f2b194a709dd8b1a6cd690de60e24dacb7653
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/1056567Reviewed-by: default avatarReid Kleckner <rnk@chromium.org>
Commit-Queue: Reid Kleckner <rnk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558132}
parent 88a573fd
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,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_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h" #include "content/public/browser/notification_service.h"
...@@ -87,10 +86,6 @@ void CreateDomainBoundCertOnIOThread( ...@@ -87,10 +86,6 @@ void CreateDomainBoundCertOnIOThread(
DCHECK_CURRENTLY_ON(content::BrowserThread::IO); DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
net::ChannelIDService* channel_id_service = net::ChannelIDService* channel_id_service =
request_context_getter->GetURLRequestContext()->channel_id_service(); request_context_getter->GetURLRequestContext()->channel_id_service();
if (!channel_id_service) {
waitable_event->Signal();
return;
}
int status = channel_id_service->GetOrCreateChannelID( int status = channel_id_service->GetOrCreateChannelID(
url.host(), channel_id_key, url.host(), channel_id_key,
base::BindRepeating(&GotDomainBoundCert, waitable_event), request); base::BindRepeating(&GotDomainBoundCert, waitable_event), request);
...@@ -116,7 +111,7 @@ std::string CreateTlsChannelId( ...@@ -116,7 +111,7 @@ std::string CreateTlsChannelId(
waitable_event.Wait(); waitable_event.Wait();
// Create the expected value. // Create the expected value.
std::vector<uint8_t> spki_vector; std::vector<uint8_t> spki_vector;
if (!channel_id_key || !channel_id_key->ExportPublicKey(&spki_vector)) if (!channel_id_key->ExportPublicKey(&spki_vector))
return std::string(); return std::string();
base::StringPiece spki(reinterpret_cast<char*>(spki_vector.data()), base::StringPiece spki(reinterpret_cast<char*>(spki_vector.data()),
spki_vector.size()); spki_vector.size());
...@@ -1195,54 +1190,6 @@ IN_PROC_BROWSER_TEST_P(ExternallyConnectableMessagingTest, ...@@ -1195,54 +1190,6 @@ IN_PROC_BROWSER_TEST_P(ExternallyConnectableMessagingTest,
EXPECT_EQ(tls_channel_id, tls_channel_id2); EXPECT_EQ(tls_channel_id, tls_channel_id2);
} }
class ExternallyConnectableMessagingTestNoChannelID
: public ExternallyConnectableMessagingTest {
public:
ExternallyConnectableMessagingTestNoChannelID() {}
~ExternallyConnectableMessagingTestNoChannelID() override {}
void SetUpCommandLine(base::CommandLine* command_line) override {
std::vector<base::Feature> enabled_features;
std::vector<base::Feature> disabled_features = {::features::kChannelID,
::features::kTokenBinding};
scoped_feature_list_.InitWithFeatures(enabled_features, disabled_features);
ExternallyConnectableMessagingTest::SetUpCommandLine(command_line);
}
private:
base::test::ScopedFeatureList scoped_feature_list_;
DISALLOW_COPY_AND_ASSIGN(ExternallyConnectableMessagingTestNoChannelID);
};
IN_PROC_BROWSER_TEST_P(ExternallyConnectableMessagingTestNoChannelID,
TlsChannelIdEmptyWhenDisabled) {
std::string expected_tls_channel_id_value =
CreateTlsChannelId(profile()->GetRequestContext(), chromium_org_url());
scoped_refptr<const Extension> chromium_connectable =
LoadChromiumConnectableExtensionWithTlsChannelId();
ASSERT_TRUE(chromium_connectable.get());
ui_test_utils::NavigateToURL(browser(), chromium_org_url());
// Check that both connect and sendMessage don't report a Channel ID.
std::string tls_channel_id_from_port_connect =
GetTlsChannelIdFromPortConnect(chromium_connectable.get(), true);
EXPECT_EQ(0u, tls_channel_id_from_port_connect.size());
std::string tls_channel_id_from_send_message =
GetTlsChannelIdFromSendMessage(chromium_connectable.get(), true);
EXPECT_EQ(0u, tls_channel_id_from_send_message.size());
}
INSTANTIATE_TEST_CASE_P(NativeBindingsNoChannelID,
ExternallyConnectableMessagingTestNoChannelID,
::testing::Values(NATIVE_BINDINGS));
INSTANTIATE_TEST_CASE_P(JavaScriptBindingsNoChannelID,
ExternallyConnectableMessagingTestNoChannelID,
::testing::Values(JAVASCRIPT_BINDINGS));
// Tests a web connectable extension that receives TLS channel id, but // Tests a web connectable extension that receives TLS channel id, but
// immediately closes its background page upon receipt of a message. // immediately closes its background page upon receipt of a message.
// Same flakiness seen in http://crbug.com/297866 // Same flakiness seen in http://crbug.com/297866
......
...@@ -62,19 +62,12 @@ void MessagePropertyProvider::GetChannelIDOnIOThread( ...@@ -62,19 +62,12 @@ void MessagePropertyProvider::GetChannelIDOnIOThread(
const std::string& host, const std::string& host,
const ChannelIDCallback& reply) { const ChannelIDCallback& reply) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO); DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
const net::HttpNetworkSession::Params* network_params = net::ChannelIDService* channel_id_service =
request_context_getter->GetURLRequestContext()->GetNetworkSessionParams(); request_context_getter->GetURLRequestContext()->channel_id_service();
GetChannelIDOutput* output = new GetChannelIDOutput(); GetChannelIDOutput* output = new GetChannelIDOutput();
net::CompletionCallback net_completion_callback = net::CompletionCallback net_completion_callback =
base::Bind(&MessagePropertyProvider::GotChannelID, original_task_runner, base::Bind(&MessagePropertyProvider::GotChannelID, original_task_runner,
base::Owned(output), reply); base::Owned(output), reply);
if (!network_params->enable_token_binding &&
!network_params->enable_channel_id) {
GotChannelID(original_task_runner, output, reply, net::ERR_FILE_NOT_FOUND);
return;
}
net::ChannelIDService* channel_id_service =
request_context_getter->GetURLRequestContext()->channel_id_service();
int status = channel_id_service->GetChannelID( int status = channel_id_service->GetChannelID(
host, &output->channel_id_key, net_completion_callback, &output->request); host, &output->channel_id_key, net_completion_callback, &output->request);
if (status == net::ERR_IO_PENDING) if (status == net::ERR_IO_PENDING)
......
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