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

Unified Diff: net/test/embedded_test_server/embedded_test_server_unittest.cc

Issue 14914010: GTTF: Convert WebContentsImplBrowserTest to use EmbeddedTestServer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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/test/embedded_test_server/embedded_test_server.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/test/embedded_test_server/embedded_test_server_unittest.cc
diff --git a/net/test/embedded_test_server/embedded_test_server_unittest.cc b/net/test/embedded_test_server/embedded_test_server_unittest.cc
index b0af14f0bac16d2aea4275ade1e791298838d995..1993ef0f931a746c7a409e4d9757b8e060ded560 100644
--- a/net/test/embedded_test_server/embedded_test_server_unittest.cc
+++ b/net/test/embedded_test_server/embedded_test_server_unittest.cc
@@ -146,6 +146,26 @@ TEST_F(EmbeddedTestServerTest, RegisterRequestHandler) {
EXPECT_EQ("/test?q=foo", request_relative_url_);
}
+TEST_F(EmbeddedTestServerTest, ServeFilesFromDirectory) {
+ base::FilePath src_dir;
+ ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &src_dir));
+ server_->ServeFilesFromDirectory(
+ src_dir.AppendASCII("net").AppendASCII("data"));
+
+ scoped_ptr<URLFetcher> fetcher(
+ URLFetcher::Create(server_->GetURL("/test.html"),
+ URLFetcher::GET,
+ this));
+ fetcher->SetRequestContext(request_context_getter_.get());
+ fetcher->Start();
+ WaitForResponses(1);
+
+ EXPECT_EQ(URLRequestStatus::SUCCESS, fetcher->GetStatus().status());
+ EXPECT_EQ(SUCCESS, fetcher->GetResponseCode());
+ EXPECT_EQ("<p>Hello World!</p>", GetContentFromFetcher(*fetcher));
+ EXPECT_EQ("", GetContentTypeFromFetcher(*fetcher));
+}
+
TEST_F(EmbeddedTestServerTest, DefaultNotFoundResponse) {
scoped_ptr<URLFetcher> fetcher(
URLFetcher::Create(server_->GetURL("/non-existent"),
« no previous file with comments | « net/test/embedded_test_server/embedded_test_server.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698