Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(998)

Unified Diff: Source/modules/fetch/RequestTest.cpp

Issue 1060033002: Implement Request.context for Fetch API (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« Source/modules/fetch/Request.cpp ('K') | « Source/modules/fetch/Request.idl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/fetch/RequestTest.cpp
diff --git a/Source/modules/fetch/RequestTest.cpp b/Source/modules/fetch/RequestTest.cpp
index 40944ccf496cb1de72b7037faee0d83a2a7775fb..9927007afe894ed7d683a08aee05ab0a1e33551d 100644
--- a/Source/modules/fetch/RequestTest.cpp
+++ b/Source/modules/fetch/RequestTest.cpp
@@ -11,6 +11,7 @@
#include "core/frame/Frame.h"
#include "core/testing/DummyPageHolder.h"
#include "public/platform/WebServiceWorkerRequest.h"
+#include "public/platform/WebURLRequest.h"
#include "wtf/HashMap.h"
#include "wtf/text/WTFString.h"
#include <gtest/gtest.h>
@@ -67,9 +68,11 @@ TEST_F(ServiceWorkerRequestTest, FromAndToWebRequest)
} headers[] = { {"X-Foo", "bar"}, {"X-Quux", "foop"}, {0, 0} };
const String referrer = "http://www.referrer.com/";
const WebReferrerPolicy referrerPolicy = WebReferrerPolicyAlways;
+ const WebURLRequest::RequestContext context = WebURLRequest::RequestContextAudio;
webRequest.setURL(url);
webRequest.setMethod(method);
+ webRequest.setRequestContext(context);
for (int i = 0; headers[i].key; ++i)
webRequest.setHeader(WebString::fromUTF8(headers[i].key), WebString::fromUTF8(headers[i].value));
webRequest.setReferrer(referrer, referrerPolicy);
@@ -78,6 +81,7 @@ TEST_F(ServiceWorkerRequestTest, FromAndToWebRequest)
ASSERT(request);
EXPECT_EQ(url, request->url());
EXPECT_EQ(method, request->method());
+ EXPECT_EQ("audio", request->context());
EXPECT_EQ(referrer, request->referrer());
Headers* requestHeaders = request->headers();
@@ -96,6 +100,7 @@ TEST_F(ServiceWorkerRequestTest, FromAndToWebRequest)
request->populateWebServiceWorkerRequest(secondWebRequest);
EXPECT_EQ(url, KURL(secondWebRequest.url()));
EXPECT_EQ(method, String(secondWebRequest.method()));
+ EXPECT_EQ(context, secondWebRequest.requestContext());
EXPECT_EQ(referrer, KURL(secondWebRequest.referrerUrl()));
EXPECT_EQ(referrerPolicy, secondWebRequest.referrerPolicy());
EXPECT_EQ(webRequest.headers(), secondWebRequest.headers());
« Source/modules/fetch/Request.cpp ('K') | « Source/modules/fetch/Request.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698