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

Unified Diff: chrome_frame/test/http_server.cc

Issue 218019: Initial import of the Chrome Frame codebase. Integration in chrome.gyp coming... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 3 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 | « chrome_frame/test/http_server.h ('k') | chrome_frame/test/icu_stubs_unittests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_frame/test/http_server.cc
===================================================================
--- chrome_frame/test/http_server.cc (revision 0)
+++ chrome_frame/test/http_server.cc (revision 0)
@@ -0,0 +1,56 @@
+// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+#include "chrome_frame/test/http_server.h"
+
+const wchar_t kDocRoot[] = L"chrome_frame\\test\\data";
+
+void ChromeFrameHTTPServer::SetUp() {
+ std::wstring document_root(kDocRoot);
+ server_ = HTTPTestServer::CreateServer(document_root, NULL, 30, 1000);
+ ASSERT_TRUE(server_ != NULL);
+
+ // copy CFInstance.js into the test directory
+ FilePath cf_source_path;
+ PathService::Get(base::DIR_SOURCE_ROOT, &cf_source_path);
+ cf_source_path = cf_source_path.Append(FILE_PATH_LITERAL("chrome_frame"));
+
+ file_util::CopyFile(cf_source_path.Append(FILE_PATH_LITERAL("CFInstance.js")),
+ cf_source_path.Append(
+ FILE_PATH_LITERAL("test")).Append(
+ FILE_PATH_LITERAL("data")).Append(
+ FILE_PATH_LITERAL("CFInstance.js"))); // NOLINT
+}
+
+void ChromeFrameHTTPServer::TearDown() {
+ if (server_) {
+ server_ = NULL;
+ }
+
+ // clobber CFInstance.js
+ FilePath cfi_path;
+ PathService::Get(base::DIR_SOURCE_ROOT, &cfi_path);
+ cfi_path = cfi_path
+ .Append(FILE_PATH_LITERAL("chrome_frame"))
+ .Append(FILE_PATH_LITERAL("test"))
+ .Append(FILE_PATH_LITERAL("data"))
+ .Append(FILE_PATH_LITERAL("CFInstance.js"));
+
+ file_util::Delete(cfi_path, false);
+}
+
+bool ChromeFrameHTTPServer::WaitToFinish(int milliseconds) {
+ if (!server_)
+ return true;
+
+ return server_->WaitToFinish(milliseconds);
+}
+
+GURL ChromeFrameHTTPServer::Resolve(const wchar_t* relative_url) {
+ return server_->TestServerPageW(relative_url);
+}
+
+std::wstring ChromeFrameHTTPServer::GetDataDir() {
+ return server_->GetDataDirectory().ToWStringHack();
+}
+
« no previous file with comments | « chrome_frame/test/http_server.h ('k') | chrome_frame/test/icu_stubs_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698