summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-11 18:41:25 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-11 18:41:25 +0000
commit999520d813ea580a52e22e71670f8b343f5c2845 (patch)
tree125a875ed1b3de385e6c88d9dbf044464aed6ebd
parent92f094bcb524f053d31d4f026be1453cb9188a60 (diff)
downloadchromium_src-999520d813ea580a52e22e71670f8b343f5c2845.zip
chromium_src-999520d813ea580a52e22e71670f8b343f5c2845.tar.gz
chromium_src-999520d813ea580a52e22e71670f8b343f5c2845.tar.bz2
Don't require tlslite to be installed, just use what's in the tree
Review URL: http://codereview.chromium.org/13745 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6794 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/process_util_mac.mm6
-rw-r--r--net/url_request/url_request_unittest.h27
2 files changed, 28 insertions, 5 deletions
diff --git a/base/process_util_mac.mm b/base/process_util_mac.mm
index a0a123a..c29b488 100644
--- a/base/process_util_mac.mm
+++ b/base/process_util_mac.mm
@@ -12,6 +12,10 @@
#include <sys/types.h>
#include <sys/wait.h>
+extern "C" {
+extern char** environ;
+}
+
namespace base {
bool LaunchApp(const std::vector<std::string>& argv,
@@ -30,7 +34,7 @@ bool LaunchApp(const std::vector<std::string>& argv,
NULL,
NULL,
argv_copy,
- NULL) == 0);
+ environ) == 0);
bool process_handle_valid = pid > 0;
if (!spawn_succeeded || !process_handle_valid) {
diff --git a/net/url_request/url_request_unittest.h b/net/url_request/url_request_unittest.h
index 786f40a..a657097 100644
--- a/net/url_request/url_request_unittest.h
+++ b/net/url_request/url_request_unittest.h
@@ -5,9 +5,12 @@
#ifndef NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_
#define NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_
+#include <stdlib.h>
+
#include <sstream>
#include <string>
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/message_loop.h"
#include "base/path_service.h"
@@ -306,9 +309,25 @@ class TestServer : public base::ProcessFilter {
base::LaunchApp(command_line, false, true, &process_handle_)) <<
"Failed to launch " << command_line;
#elif defined(OS_POSIX)
- bool tlslite_installed = !access("/usr/bin/tls.py", X_OK) ||
- !access("/usr/local/bin/tls.py", X_OK);
- ASSERT_TRUE(tlslite_installed) << "tlslite not installed? Please run 'python setup.py install' in third_party/tlslite.";
+ // Set up PYTHONPATH so that Python is able to find the in-tree copy of
+ // tlslite.
+
+ FilePath tlslite_path;
+ ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &tlslite_path));
+ tlslite_path = tlslite_path.Append("third_party");
+ tlslite_path = tlslite_path.Append("tlslite");
+
+ const char kPythonPath[] = "PYTHONPATH";
+ char* python_path_c = getenv(kPythonPath);
+ if (python_path_c) {
+ // PYTHONPATH is already set, append to it.
+ std::string python_path(python_path_c);
+ python_path.append(":");
+ python_path.append(tlslite_path.value());
+ setenv(kPythonPath, python_path.c_str(), 1);
+ } else {
+ setenv(kPythonPath, tlslite_path.value().c_str(), 1);
+ }
std::vector<std::string> command_line;
command_line.push_back("python");
@@ -331,7 +350,7 @@ class TestServer : public base::ProcessFilter {
retries--;
PlatformThread::Sleep(500);
}
- ASSERT_TRUE(success) << "Webserver not starting properly. (On Linux, you need to install third_party/tlslite.)";
+ ASSERT_TRUE(success) << "Webserver not starting properly.";
init_successful_ = true;
is_shutdown_ = false;