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

Unified Diff: net/proxy/proxy_script_fetcher_unittest.cc

Issue 210028: Respect the charset specified in PAC file responses. ProxyScriptFetcher is no... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: re-order parameter so output is last Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/proxy/proxy_script_fetcher.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_script_fetcher_unittest.cc
===================================================================
--- net/proxy/proxy_script_fetcher_unittest.cc (revision 26789)
+++ net/proxy/proxy_script_fetcher_unittest.cc (working copy)
@@ -289,4 +289,39 @@
}
}
+// The ProxyScriptFetcher should decode any content-codings
+// (like gzip, bzip, etc.), and apply any charset conversions to yield
+// UTF8.
+TEST_F(ProxyScriptFetcherTest, Encodings) {
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot, NULL);
+ ASSERT_TRUE(NULL != server.get());
+ scoped_refptr<URLRequestContext> context = new RequestContext;
+ scoped_ptr<ProxyScriptFetcher> pac_fetcher(
+ ProxyScriptFetcher::Create(context));
+
+ // Test a response that is gzip-encoded -- should get inflated.
+ {
+ GURL url = server->TestServerPage("files/gzipped_pac");
+ std::string bytes;
+ TestCompletionCallback callback;
+ int result = pac_fetcher->Fetch(url, &bytes, &callback);
+ EXPECT_EQ(ERR_IO_PENDING, result);
+ EXPECT_EQ(OK, callback.WaitForResult());
+ EXPECT_EQ("This data was gzipped.\n", bytes);
+ }
+
+ // Test a response that was served as UTF-16 (BE). It should
+ // be converted to UTF8.
+ {
+ GURL url = server->TestServerPage("files/utf16be_pac");
+ std::string bytes;
+ TestCompletionCallback callback;
+ int result = pac_fetcher->Fetch(url, &bytes, &callback);
+ EXPECT_EQ(ERR_IO_PENDING, result);
+ EXPECT_EQ(OK, callback.WaitForResult());
+ EXPECT_EQ("This was encoded as UTF-16BE.\n", bytes);
+ }
+}
+
} // namespace net
« no previous file with comments | « net/proxy/proxy_script_fetcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698