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

Side by Side Diff: chrome/browser/resource_dispatcher_host_uitest.cc

Issue 12982: Disable the content sniffing algorithm if the server instructs us to do so wi... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 12 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resource_dispatcher_host.cc ('k') | chrome/test/data/nosniff-test.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <sstream> 5 #include <sstream>
6 #include <string> 6 #include <string>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 }; 44 };
45 45
46 } // namespace 46 } // namespace
47 47
48 TEST_F(ResourceDispatcherTest, SniffHTMLWithNoContentType) { 48 TEST_F(ResourceDispatcherTest, SniffHTMLWithNoContentType) {
49 CheckTitleTest(L"content-sniffer-test0.html", 49 CheckTitleTest(L"content-sniffer-test0.html",
50 L"Content Sniffer Test 0"); 50 L"Content Sniffer Test 0");
51 } 51 }
52 52
53 TEST_F(ResourceDispatcherTest, RespectNoSniffDirective) {
54 CheckTitleTest(L"nosniff-test.html", L"");
55 }
56
53 TEST_F(ResourceDispatcherTest, DoNotSniffHTMLFromTextPlain) { 57 TEST_F(ResourceDispatcherTest, DoNotSniffHTMLFromTextPlain) {
54 CheckTitleTest(L"content-sniffer-test1.html", L""); 58 CheckTitleTest(L"content-sniffer-test1.html", L"");
55 } 59 }
56 60
57 TEST_F(ResourceDispatcherTest, DoNotSniffHTMLFromImageGIF) { 61 TEST_F(ResourceDispatcherTest, DoNotSniffHTMLFromImageGIF) {
58 CheckTitleTest(L"content-sniffer-test2.html", L""); 62 CheckTitleTest(L"content-sniffer-test2.html", L"");
59 } 63 }
60 64
61 TEST_F(ResourceDispatcherTest, SniffNoContentTypeNoData) { 65 TEST_F(ResourceDispatcherTest, SniffNoContentTypeNoData) {
62 CheckTitleTest(L"content-sniffer-test3.html", 66 CheckTitleTest(L"content-sniffer-test3.html",
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 // (Test by redirecting to javascript:window.location='someURL'.) 261 // (Test by redirecting to javascript:window.location='someURL'.)
258 GURL test_url(server.TestServerPageW(L"files/title2.html")); 262 GURL test_url(server.TestServerPageW(L"files/title2.html"));
259 std::wstring redirect_url = L"javascript:window.location='" + 263 std::wstring redirect_url = L"javascript:window.location='" +
260 ASCIIToWide(test_url.possibly_invalid_spec()) + L"'"; 264 ASCIIToWide(test_url.possibly_invalid_spec()) + L"'";
261 tab->NavigateToURLAsync(GURL(redirect_url)); 265 tab->NavigateToURLAsync(GURL(redirect_url));
262 Sleep(kWaitForActionMsec); // Wait for JavaScript redirect to happen. 266 Sleep(kWaitForActionMsec); // Wait for JavaScript redirect to happen.
263 EXPECT_TRUE(tab->GetTabTitle(&tab_title)); 267 EXPECT_TRUE(tab->GetTabTitle(&tab_title));
264 EXPECT_EQ(L"Title Of Awesomeness", tab_title); 268 EXPECT_EQ(L"Title Of Awesomeness", tab_title);
265 } 269 }
266 270
OLDNEW
« no previous file with comments | « chrome/browser/resource_dispatcher_host.cc ('k') | chrome/test/data/nosniff-test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698