Commit 5fb68029 authored by Robbie McElrath's avatar Robbie McElrath Committed by Commit Bot

Reland "Re-enable VariationsHttpHeadersBrowserTest tests on ChromeOS."

This is a reland of b050ee2d with a
speculative fix for the underlying issue. According to the most recent
failures, the test failed due to the network changing during one of the
test requests. This makes the test wait for an ethernet connection
before running to make sure the requests don't get interrupted.

Original change's description:
> Re-enable VariationsHttpHeadersBrowserTest tests on ChromeOS.
>
> I can't reproduce flakes locally, so I'm going to re-enable them and see
> if we've fixed them in the last couple months. I also added additional
> assertions to the test so we'll get more information about why they fail
> if they do.
>
> Bug: 964338
> Change-Id: I4a864101de6cfb1b434c3b2157d2323d8e6e522a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1693704
> Reviewed-by: Eric Roman <eroman@chromium.org>
> Commit-Queue: Robbie McElrath <rmcelrath@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#675871}

Bug: 964338
Change-Id: I6b3c09d6b3e464b29288a63d1413957cdbaeb46f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1696009Reviewed-by: default avatarEric Roman <eroman@chromium.org>
Commit-Queue: Robbie McElrath <rmcelrath@chromium.org>
Cr-Commit-Position: refs/heads/master@{#677040}
parent f5c5bf01
......@@ -28,6 +28,7 @@
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/network_connection_change_simulator.h"
#include "content/public/test/simple_url_loader_test_helper.h"
#include "net/base/escape.h"
#include "net/dns/mock_host_resolver.h"
......@@ -79,6 +80,9 @@ class VariationsHttpHeadersBrowserTest : public InProcessBrowserTest {
void SetUpOnMainThread() override {
InProcessBrowserTest::SetUpOnMainThread();
content::NetworkConnectionChangeSimulator().SetConnectionType(
network::mojom::ConnectionType::CONNECTION_ETHERNET);
host_resolver()->AddRule("*", "127.0.0.1");
base::FilePath test_data_dir;
......@@ -325,17 +329,9 @@ IN_PROC_BROWSER_TEST_F(VariationsHttpHeadersBrowserTest,
EXPECT_FALSE(HasReceivedHeader(GetExampleUrl(), "X-Client-Data"));
}
#if defined(OS_CHROMEOS)
// See https://crbug.com/964338
#define MAYBE_TestStrippingHeadersFromRequestUsingSimpleURLLoaderWithProfileNetworkContext \
DISABLED_TestStrippingHeadersFromRequestUsingSimpleURLLoaderWithProfileNetworkContext
#else
#define MAYBE_TestStrippingHeadersFromRequestUsingSimpleURLLoaderWithProfileNetworkContext \
TestStrippingHeadersFromRequestUsingSimpleURLLoaderWithProfileNetworkContext
#endif
IN_PROC_BROWSER_TEST_F(
VariationsHttpHeadersBrowserTest,
MAYBE_TestStrippingHeadersFromRequestUsingSimpleURLLoaderWithProfileNetworkContext) {
TestStrippingHeadersFromRequestUsingSimpleURLLoaderWithProfileNetworkContext) {
GURL url = GetGoogleRedirectUrl1();
auto resource_request = std::make_unique<network::ResourceRequest>();
......@@ -356,6 +352,7 @@ IN_PROC_BROWSER_TEST_F(
// Wait for the response to complete.
loader_helper.WaitForCallback();
EXPECT_EQ(net::OK, loader->NetError());
EXPECT_TRUE(loader_helper.response_body());
EXPECT_TRUE(HasReceivedHeader(GetGoogleRedirectUrl1(), "X-Client-Data"));
......@@ -364,17 +361,9 @@ IN_PROC_BROWSER_TEST_F(
EXPECT_FALSE(HasReceivedHeader(GetExampleUrl(), "X-Client-Data"));
}
#if defined(OS_CHROMEOS)
// See https://crbug.com/964338
#define MAYBE_TestStrippingHeadersFromRequestUsingSimpleURLLoaderWithGlobalSystemNetworkContext \
DISABLED_TestStrippingHeadersFromRequestUsingSimpleURLLoaderWithGlobalSystemNetworkContext
#else
#define MAYBE_TestStrippingHeadersFromRequestUsingSimpleURLLoaderWithGlobalSystemNetworkContext \
TestStrippingHeadersFromRequestUsingSimpleURLLoaderWithGlobalSystemNetworkContext
#endif
IN_PROC_BROWSER_TEST_F(
VariationsHttpHeadersBrowserTest,
MAYBE_TestStrippingHeadersFromRequestUsingSimpleURLLoaderWithGlobalSystemNetworkContext) {
TestStrippingHeadersFromRequestUsingSimpleURLLoaderWithGlobalSystemNetworkContext) {
GURL url = GetGoogleRedirectUrl1();
auto resource_request = std::make_unique<network::ResourceRequest>();
......@@ -395,6 +384,7 @@ IN_PROC_BROWSER_TEST_F(
// Wait for the response to complete.
loader_helper.WaitForCallback();
EXPECT_EQ(net::OK, loader->NetError());
EXPECT_TRUE(loader_helper.response_body());
EXPECT_TRUE(HasReceivedHeader(GetGoogleRedirectUrl1(), "X-Client-Data"));
......
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