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

Side by Side Diff: content/browser/loader/mime_sniffing_resource_handler_unittest.cc

Issue 2303443005: Send an image-like 'Accept' header for favicons. (Closed)
Patch Set: Test. Created 4 years, 3 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
« no previous file with comments | « content/browser/loader/mime_sniffing_resource_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/loader/mime_sniffing_resource_handler.h" 5 #include "content/browser/loader/mime_sniffing_resource_handler.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 TestAcceptHeaderSetting(RESOURCE_TYPE_MAIN_FRAME)); 703 TestAcceptHeaderSetting(RESOURCE_TYPE_MAIN_FRAME));
704 EXPECT_EQ( 704 EXPECT_EQ(
705 "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp," 705 "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,"
706 "*/*;q=0.8", 706 "*/*;q=0.8",
707 TestAcceptHeaderSetting(RESOURCE_TYPE_SUB_FRAME)); 707 TestAcceptHeaderSetting(RESOURCE_TYPE_SUB_FRAME));
708 EXPECT_EQ("text/css,*/*;q=0.1", 708 EXPECT_EQ("text/css,*/*;q=0.1",
709 TestAcceptHeaderSetting(RESOURCE_TYPE_STYLESHEET)); 709 TestAcceptHeaderSetting(RESOURCE_TYPE_STYLESHEET));
710 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_SCRIPT)); 710 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_SCRIPT));
711 EXPECT_EQ("image/webp,image/*,*/*;q=0.8", 711 EXPECT_EQ("image/webp,image/*,*/*;q=0.8",
712 TestAcceptHeaderSetting(RESOURCE_TYPE_IMAGE)); 712 TestAcceptHeaderSetting(RESOURCE_TYPE_IMAGE));
713 EXPECT_EQ("image/webp,image/*,*/*;q=0.8",
714 TestAcceptHeaderSetting(RESOURCE_TYPE_FAVICON));
713 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_FONT_RESOURCE)); 715 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_FONT_RESOURCE));
714 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_SUB_RESOURCE)); 716 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_SUB_RESOURCE));
715 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_OBJECT)); 717 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_OBJECT));
716 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_MEDIA)); 718 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_MEDIA));
717 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_WORKER)); 719 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_WORKER));
718 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_SHARED_WORKER)); 720 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_SHARED_WORKER));
719 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_PREFETCH)); 721 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_PREFETCH));
720 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_FAVICON));
721 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_XHR)); 722 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_XHR));
722 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_PING)); 723 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_PING));
723 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_SERVICE_WORKER)); 724 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_SERVICE_WORKER));
724 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_CSP_REPORT)); 725 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_CSP_REPORT));
725 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_PLUGIN_RESOURCE)); 726 EXPECT_EQ("*/*", TestAcceptHeaderSetting(RESOURCE_TYPE_PLUGIN_RESOURCE));
726 727
727 // Ensure that if an Accept header is already set, it is not overwritten. 728 // Ensure that if an Accept header is already set, it is not overwritten.
728 net::URLRequestContext context; 729 net::URLRequestContext context;
729 std::unique_ptr<net::URLRequest> request(context.CreateRequest( 730 std::unique_ptr<net::URLRequest> request(context.CreateRequest(
730 GURL("http://www.google.com"), net::DEFAULT_PRIORITY, nullptr)); 731 GURL("http://www.google.com"), net::DEFAULT_PRIORITY, nullptr));
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 // handle the download. 1005 // handle the download.
1005 bool defer = false; 1006 bool defer = false;
1006 mime_handler->OnResponseStarted(response.get(), &defer); 1007 mime_handler->OnResponseStarted(response.get(), &defer);
1007 EXPECT_FALSE(defer); 1008 EXPECT_FALSE(defer);
1008 EXPECT_FALSE(host.new_resource_handler()); 1009 EXPECT_FALSE(host.new_resource_handler());
1009 1010
1010 content::RunAllPendingInMessageLoop(); 1011 content::RunAllPendingInMessageLoop();
1011 } 1012 }
1012 1013
1013 } // namespace content 1014 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/mime_sniffing_resource_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698