diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-17 20:07:11 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-17 20:07:11 +0000 |
commit | 95409e1020037b0bbfbce17f861d3de090d10186 (patch) | |
tree | 90a893af1247b1d4a3767c5ab14aae797f467946 /webkit/glue/unittest_test_server.h | |
parent | 701e869b30deffda579c5c413cf1d73defee34fa (diff) | |
download | chromium_src-95409e1020037b0bbfbce17f861d3de090d10186.zip chromium_src-95409e1020037b0bbfbce17f861d3de090d10186.tar.gz chromium_src-95409e1020037b0bbfbce17f861d3de090d10186.tar.bz2 |
Test server cleanup patch of death:
- reduce the number of different classes
- clean up the internal code
- modify the interface to expose less internal details
(this will allow more flexibility with port numbers)
TEST=many
BUG=49680
Review URL: http://codereview.chromium.org/3080029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56405 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/unittest_test_server.h')
-rw-r--r-- | webkit/glue/unittest_test_server.h | 53 |
1 files changed, 4 insertions, 49 deletions
diff --git a/webkit/glue/unittest_test_server.h b/webkit/glue/unittest_test_server.h index fe282ec..575f0f9 100644 --- a/webkit/glue/unittest_test_server.h +++ b/webkit/glue/unittest_test_server.h @@ -9,58 +9,13 @@ #include "net/test/test_server.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/appcache/appcache_interfaces.h" -#include "webkit/glue/resource_loader_bridge.h" - -using webkit_glue::ResourceLoaderBridge; - -// We need to use ResourceLoaderBridge to communicate with the testserver -// instead of using URLRequest directly because URLRequests need to be run on -// the test_shell's IO thread. -class UnittestTestServer : public net::HTTPTestServer { - protected: - UnittestTestServer() { - } +class UnittestTestServer : public net::TestServer { public: - static UnittestTestServer* CreateServer() { - UnittestTestServer* test_server = new UnittestTestServer(); - FilePath no_cert; - FilePath docroot(FILE_PATH_LITERAL("webkit/data")); - if (!test_server->Start(net::TestServerLauncher::ProtoHTTP, - "localhost", 1337, docroot, no_cert, std::wstring())) { - delete test_server; - return NULL; - } - return test_server; + UnittestTestServer() + : net::TestServer(net::TestServer::TYPE_HTTP, + FilePath(FILE_PATH_LITERAL("webkit/data"))) { } - - virtual bool MakeGETRequest(const std::string& page_name) { - GURL url(TestServerPage(page_name)); - webkit_glue::ResourceLoaderBridge::RequestInfo request_info; - request_info.method = "GET"; - request_info.url = url; - request_info.first_party_for_cookies = url; - request_info.referrer = GURL(); // No referrer. - request_info.frame_origin = "null"; - request_info.main_frame_origin = "null"; - request_info.headers = std::string(); // No extra headers. - request_info.load_flags = net::LOAD_NORMAL; - request_info.requestor_pid = 0; - request_info.request_type = ResourceType::SUB_RESOURCE; - request_info.request_context = 0; - request_info.appcache_host_id = appcache::kNoHostId; - request_info.routing_id = 0; - scoped_ptr<ResourceLoaderBridge> loader( - ResourceLoaderBridge::Create(request_info)); - EXPECT_TRUE(loader.get()); - - ResourceLoaderBridge::SyncLoadResponse resp; - loader->SyncLoad(&resp); - return resp.status.is_success(); - } - - private: - virtual ~UnittestTestServer() {} }; #endif // WEBKIT_GLUE_UNITTEST_TEST_SERVER_H__ |