Skip to content

Commit

Permalink
Updates for WebSocket and URLRequest tests for cookie changes.
Browse files Browse the repository at this point in the history
We're becoming picker about 1st party vs. 3rd party distinction, requiring
explicit marking, so adjust tests.

This doesn't help some of the metrics tests in URLRequest

Bug: 1016512

Change-Id: Ib07d460840d7c7796810b57b0ee95d8676b7bb95
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1872638
Commit-Queue: Maksim Orlovich <morlovich@chromium.org>
Reviewed-by: Lily Chen <chlily@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708204}
  • Loading branch information
Maks Orlovich authored and Commit Bot committed Oct 22, 2019
1 parent 5f8498d commit fc69c6f
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 64 deletions.
10 changes: 10 additions & 0 deletions net/url_request/url_request_test_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ void TestURLRequestContext::Init() {
}
}

std::unique_ptr<URLRequest> TestURLRequestContext::CreateFirstPartyRequest(
const GURL& url,
RequestPriority priority,
URLRequest::Delegate* delegate,
NetworkTrafficAnnotationTag traffic_annotation) const {
auto req = CreateRequest(url, priority, delegate, traffic_annotation);
req->set_site_for_cookies(url);
return req;
}

TestURLRequestContextGetter::TestURLRequestContextGetter(
const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner)
: network_task_runner_(network_task_runner) {
Expand Down
8 changes: 8 additions & 0 deletions net/url_request/url_request_test_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ class TestURLRequestContext : public URLRequestContext {
create_default_http_user_agent_settings_ = value;
}

// Like CreateRequest, but also updates |site_for_cookies| to give the request
// a 1st-party context.
std::unique_ptr<URLRequest> CreateFirstPartyRequest(
const GURL& url,
RequestPriority priority,
URLRequest::Delegate* delegate,
NetworkTrafficAnnotationTag traffic_annotation) const;

private:
bool initialized_ = false;

Expand Down
Loading

0 comments on commit fc69c6f

Please sign in to comment.