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

Side by Side Diff: net/test/python_utils_unittest.cc

Issue 3366026: Add python_utils to append to python path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/test/python_utils.cc ('k') | net/test/test_server.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/environment.h"
6 #include "base/file_path.h"
7 #include "base/scoped_ptr.h"
8 #include "net/test/python_utils.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 TEST(PythonUtils, Append) {
12 const FilePath::CharType kAppendDir1[] =
13 FILE_PATH_LITERAL("test/path_append1");
14 const FilePath::CharType kAppendDir2[] =
15 FILE_PATH_LITERAL("test/path_append2");
16
17 scoped_ptr<base::Environment> env(base::Environment::Create());
18
19 std::string python_path;
20 FilePath append_path1(kAppendDir1);
21 FilePath append_path2(kAppendDir2);
22
23 // Get a clean start
24 env->UnSetVar(kPythonPathEnv);
25
26 // Append the path
27 AppendToPythonPath(append_path1);
28 env->GetVar(kPythonPathEnv, &python_path);
29 ASSERT_EQ(python_path, "test/path_append1");
30
31 // Append the safe path again, nothing changes
32 AppendToPythonPath(append_path2);
33 env->GetVar(kPythonPathEnv, &python_path);
34 #if defined(OS_WIN)
35 ASSERT_EQ(std::string("test/path_append1;test/path_append2"), python_path);
36 #elif defined(OS_POSIX)
37 ASSERT_EQ(std::string("test/path_append1:test/path_append2"), python_path);
38 #endif
39 }
40
41 TEST(PythonUtils, PythonRunTime) {
42 FilePath dir;
43 EXPECT_TRUE(GetPythonRunTime(&dir));
44 #if defined(OS_WIN)
45 EXPECT_NE(std::wstring::npos,
46 dir.value().find(L"third_party\\python_24\\python.exe"));
47 #elif defined(OS_POSIX)
48 EXPECT_NE(std::string::npos, dir.value().find("python"));
49 #endif
50 }
51
OLDNEW
« no previous file with comments | « net/test/python_utils.cc ('k') | net/test/test_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698