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

Side by Side Diff: ppapi/tests/test_url_loader.cc

Issue 2254693002: Delay generation of User-Agent header to URLRequestHttpJob and accept custom User-Agent from XHR/Fe… Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed Android test Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/tests/test_url_loader.h" 5 #include "ppapi/tests/test_url_loader.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <string.h> 9 #include <string.h>
10 #include <string> 10 #include <string>
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted("GET", "Dnt:\n")); 604 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted("GET", "Dnt:\n"));
605 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted("GET", "Expect:\n")); 605 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted("GET", "Expect:\n"));
606 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted("GET", "Host:\n")); 606 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted("GET", "Host:\n"));
607 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted("GET", "Keep-Alive:\n")); 607 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted("GET", "Keep-Alive:\n"));
608 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted("GET", "Referer:\n")); 608 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted("GET", "Referer:\n"));
609 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted("GET", "TE:\n")); 609 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted("GET", "TE:\n"));
610 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted("GET", "Trailer:\n")); 610 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted("GET", "Trailer:\n"));
611 ASSERT_EQ(PP_ERROR_NOACCESS, 611 ASSERT_EQ(PP_ERROR_NOACCESS,
612 OpenUntrusted("GET", "Transfer-Encoding:\n")); 612 OpenUntrusted("GET", "Transfer-Encoding:\n"));
613 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted("GET", "Upgrade:\n")); 613 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted("GET", "Upgrade:\n"));
614 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted("GET", "User-Agent:\n"));
615 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted("GET", "Via:\n")); 614 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted("GET", "Via:\n"));
616 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted( 615 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted(
617 "GET", "Proxy-Authorization: Basic dXNlcjpwYXNzd29yZA==:\n")); 616 "GET", "Proxy-Authorization: Basic dXNlcjpwYXNzd29yZA==:\n"));
618 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted("GET", "Sec-foo:\n")); 617 ASSERT_EQ(PP_ERROR_NOACCESS, OpenUntrusted("GET", "Sec-foo:\n"));
619 } 618 }
620 // Untrusted requests with custom referrer should fail. 619 // Untrusted requests with custom referrer should fail.
621 { 620 {
622 pp::URLRequestInfo request(instance_); 621 pp::URLRequestInfo request(instance_);
623 request.SetCustomReferrerURL("http://www.google.com/"); 622 request.SetCustomReferrerURL("http://www.google.com/");
624 623
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 std::string TestURLLoader::TestXRequestedWithHeader() { 873 std::string TestURLLoader::TestXRequestedWithHeader() {
875 pp::URLRequestInfo request(instance_); 874 pp::URLRequestInfo request(instance_);
876 request.SetURL("/echoheader?X-Requested-With"); 875 request.SetURL("/echoheader?X-Requested-With");
877 // The name and version of the plugin is set from the command-line (see 876 // The name and version of the plugin is set from the command-line (see
878 // chrome/test/ppapi/ppapi_test.cc. 877 // chrome/test/ppapi/ppapi_test.cc.
879 return LoadAndCompareBody(request, "PPAPITests/1.2.3"); 878 return LoadAndCompareBody(request, "PPAPITests/1.2.3");
880 } 879 }
881 880
882 // TODO(viettrungluu): Add tests for Get{Upload,Download}Progress, Close 881 // TODO(viettrungluu): Add tests for Get{Upload,Download}Progress, Close
883 // (including abort tests if applicable). 882 // (including abort tests if applicable).
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698