OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome_frame/test/http_server.h" | 5 #include "chrome_frame/test/http_server.h" |
6 | 6 |
| 7 #include "base/base_paths.h" |
| 8 #include "base/file_util.h" |
| 9 #include "base/path_service.h" |
7 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/utf_string_conversions.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" |
8 | 13 |
9 const wchar_t kDocRoot[] = L"chrome_frame\\test\\data"; | 14 const wchar_t kDocRoot[] = L"chrome_frame\\test\\data"; |
10 | 15 |
11 void ChromeFrameHTTPServer::SetUp() { | 16 void ChromeFrameHTTPServer::SetUp() { |
12 std::wstring document_root(kDocRoot); | 17 std::wstring document_root(kDocRoot); |
13 server_ = HTTPTestServer::CreateServer(document_root); | 18 server_ = net::HTTPTestServer::CreateServer(document_root); |
14 ASSERT_TRUE(server_ != NULL); | 19 ASSERT_TRUE(server_ != NULL); |
15 | 20 |
16 // copy CFInstance.js into the test directory | 21 // copy CFInstance.js into the test directory |
17 FilePath cf_source_path; | 22 FilePath cf_source_path; |
18 PathService::Get(base::DIR_SOURCE_ROOT, &cf_source_path); | 23 PathService::Get(base::DIR_SOURCE_ROOT, &cf_source_path); |
19 cf_source_path = cf_source_path.Append(FILE_PATH_LITERAL("chrome_frame")); | 24 cf_source_path = cf_source_path.Append(FILE_PATH_LITERAL("chrome_frame")); |
20 | 25 |
21 file_util::CopyFile(cf_source_path.Append(FILE_PATH_LITERAL("CFInstance.js")), | 26 file_util::CopyFile(cf_source_path.Append(FILE_PATH_LITERAL("CFInstance.js")), |
22 cf_source_path.Append( | 27 cf_source_path.Append( |
23 FILE_PATH_LITERAL("test")).Append( | 28 FILE_PATH_LITERAL("test")).Append( |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 71 } |
67 | 72 |
68 // TODO(phajdan.jr): Change wchar_t* to std::string& and fix callers. | 73 // TODO(phajdan.jr): Change wchar_t* to std::string& and fix callers. |
69 GURL ChromeFrameHTTPServer::Resolve(const wchar_t* relative_url) { | 74 GURL ChromeFrameHTTPServer::Resolve(const wchar_t* relative_url) { |
70 return server_->TestServerPage(WideToUTF8(relative_url)); | 75 return server_->TestServerPage(WideToUTF8(relative_url)); |
71 } | 76 } |
72 | 77 |
73 FilePath ChromeFrameHTTPServer::GetDataDir() { | 78 FilePath ChromeFrameHTTPServer::GetDataDir() { |
74 return server_->GetDataDirectory(); | 79 return server_->GetDataDirectory(); |
75 } | 80 } |
OLD | NEW |