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 "webkit/appcache/appcache_interfaces.h" | 8 #include "webkit/appcache/appcache_interfaces.h" |
9 #include "webkit/glue/resource_loader_bridge.h" | 9 #include "webkit/glue/resource_loader_bridge.h" |
10 #include "net/base/load_flags.h" | 10 #include "net/base/load_flags.h" |
11 #include "net/url_request/url_request_unittest.h" | 11 #include "net/url_request/url_request_unittest.h" |
12 | 12 |
13 using webkit_glue::ResourceLoaderBridge; | 13 using webkit_glue::ResourceLoaderBridge; |
14 | 14 |
15 // We need to use ResourceLoaderBridge to communicate with the testserver | 15 // We need to use ResourceLoaderBridge to communicate with the testserver |
16 // instead of using URLRequest directly because URLRequests need to be run on | 16 // instead of using URLRequest directly because URLRequests need to be run on |
17 // the test_shell's IO thread. | 17 // the test_shell's IO thread. |
18 class UnittestTestServer : public HTTPTestServer { | 18 class UnittestTestServer : public HTTPTestServer { |
19 protected: | 19 protected: |
20 UnittestTestServer() { | 20 UnittestTestServer() { |
21 } | 21 } |
22 | 22 |
23 public: | 23 public: |
24 static UnittestTestServer* CreateServer() { | 24 static UnittestTestServer* CreateServer() { |
25 UnittestTestServer* test_server = new UnittestTestServer(); | 25 UnittestTestServer* test_server = new UnittestTestServer(); |
26 FilePath no_cert; | 26 FilePath no_cert; |
27 FilePath docroot = FilePath::FromWStringHack(L"webkit/data"); | 27 FilePath docroot(FILE_PATH_LITERAL("webkit/data")); |
28 if (!test_server->Start(net::TestServerLauncher::ProtoHTTP, | 28 if (!test_server->Start(net::TestServerLauncher::ProtoHTTP, |
29 "localhost", 1337, docroot, no_cert, std::wstring())) { | 29 "localhost", 1337, docroot, no_cert, std::wstring())) { |
30 delete test_server; | 30 delete test_server; |
31 return NULL; | 31 return NULL; |
32 } | 32 } |
33 return test_server; | 33 return test_server; |
34 } | 34 } |
35 | 35 |
36 virtual ~UnittestTestServer() { | 36 virtual ~UnittestTestServer() { |
37 } | 37 } |
(...skipping 15 matching lines...) Expand all Loading... |
53 0)); | 53 0)); |
54 EXPECT_TRUE(loader.get()); | 54 EXPECT_TRUE(loader.get()); |
55 | 55 |
56 ResourceLoaderBridge::SyncLoadResponse resp; | 56 ResourceLoaderBridge::SyncLoadResponse resp; |
57 loader->SyncLoad(&resp); | 57 loader->SyncLoad(&resp); |
58 return resp.status.is_success(); | 58 return resp.status.is_success(); |
59 } | 59 } |
60 }; | 60 }; |
61 | 61 |
62 #endif // WEBKIT_GLUE_UNITTEST_TEST_SERVER_H__ | 62 #endif // WEBKIT_GLUE_UNITTEST_TEST_SERVER_H__ |
OLD | NEW |