| OLD | NEW |
| 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 #ifndef WEBKIT_GLUE_UNITTEST_TEST_SERVER_H__ | 5 #ifndef WEBKIT_GLUE_UNITTEST_TEST_SERVER_H__ |
| 6 #define WEBKIT_GLUE_UNITTEST_TEST_SERVER_H__ | 6 #define WEBKIT_GLUE_UNITTEST_TEST_SERVER_H__ |
| 7 | 7 |
| 8 #include "net/base/load_flags.h" |
| 9 #include "net/test/test_server.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "webkit/appcache/appcache_interfaces.h" | 11 #include "webkit/appcache/appcache_interfaces.h" |
| 9 #include "webkit/glue/resource_loader_bridge.h" | 12 #include "webkit/glue/resource_loader_bridge.h" |
| 10 #include "net/base/load_flags.h" | |
| 11 #include "net/url_request/url_request_unittest.h" | |
| 12 | 13 |
| 13 using webkit_glue::ResourceLoaderBridge; | 14 using webkit_glue::ResourceLoaderBridge; |
| 14 | 15 |
| 15 // We need to use ResourceLoaderBridge to communicate with the testserver | 16 // We need to use ResourceLoaderBridge to communicate with the testserver |
| 16 // instead of using URLRequest directly because URLRequests need to be run on | 17 // instead of using URLRequest directly because URLRequests need to be run on |
| 17 // the test_shell's IO thread. | 18 // the test_shell's IO thread. |
| 18 class UnittestTestServer : public HTTPTestServer { | 19 class UnittestTestServer : public net::HTTPTestServer { |
| 19 protected: | 20 protected: |
| 20 UnittestTestServer() { | 21 UnittestTestServer() { |
| 21 } | 22 } |
| 22 | 23 |
| 23 public: | 24 public: |
| 24 static UnittestTestServer* CreateServer() { | 25 static UnittestTestServer* CreateServer() { |
| 25 UnittestTestServer* test_server = new UnittestTestServer(); | 26 UnittestTestServer* test_server = new UnittestTestServer(); |
| 26 FilePath no_cert; | 27 FilePath no_cert; |
| 27 FilePath docroot(FILE_PATH_LITERAL("webkit/data")); | 28 FilePath docroot(FILE_PATH_LITERAL("webkit/data")); |
| 28 if (!test_server->Start(net::TestServerLauncher::ProtoHTTP, | 29 if (!test_server->Start(net::TestServerLauncher::ProtoHTTP, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 56 ResourceLoaderBridge::SyncLoadResponse resp; | 57 ResourceLoaderBridge::SyncLoadResponse resp; |
| 57 loader->SyncLoad(&resp); | 58 loader->SyncLoad(&resp); |
| 58 return resp.status.is_success(); | 59 return resp.status.is_success(); |
| 59 } | 60 } |
| 60 | 61 |
| 61 private: | 62 private: |
| 62 virtual ~UnittestTestServer() {} | 63 virtual ~UnittestTestServer() {} |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 #endif // WEBKIT_GLUE_UNITTEST_TEST_SERVER_H__ | 66 #endif // WEBKIT_GLUE_UNITTEST_TEST_SERVER_H__ |
| OLD | NEW |