Chromium Code Reviews| Index: content/test/content_test_suite_base.cc |
| diff --git a/content/test/content_test_suite_base.cc b/content/test/content_test_suite_base.cc |
| index 3274f1bc3c77988a51ba1a63b789d64ecded4be3..d2513be639f66303048c08704dcd67203565baa9 100644 |
| --- a/content/test/content_test_suite_base.cc |
| +++ b/content/test/content_test_suite_base.cc |
| @@ -4,6 +4,11 @@ |
| #include "content/public/test/content_test_suite_base.h" |
| +#if defined(OS_CHROMEOS) |
| +#include <stdio.h> |
| +#include <unistd.h> |
| +#endif // defined(OS_CHROMEOS) |
| + |
| #include "base/basictypes.h" |
| #include "base/compiler_specific.h" |
| #include "base/memory/scoped_ptr.h" |
| @@ -21,9 +26,27 @@ ContentTestSuiteBase::ContentTestSuiteBase(int argc, char** argv) |
| : base::TestSuite(argc, argv) { |
| } |
| +static bool IsPythonProcess() { |
| +#if defined(OS_CHROMEOS) |
| + char buf[80]; |
| + int num_read = readlink("/proc/self/exe", buf, sizeof(buf) - 1); |
| + if (num_read == -1) |
| + return false; |
| + buf[num_read] = 0; |
| + const char kPythonPrefix[] = "/python"; |
| + return !strncmp(strrchr(buf, '/'), kPythonPrefix, sizeof(kPythonPrefix) - 1); |
| +#endif // defined(OS_CHROMEOS) |
| + return false; |
|
Nirnimesh
2012/07/20 01:57:37
This statement is not true for non-chromeos. At le
glotov
2012/07/20 16:28:57
Done.
|
| +} |
| + |
| void ContentTestSuiteBase::Initialize() { |
| base::TestSuite::Initialize(); |
| - media::InitializeMediaLibraryForTesting(); |
| + |
| + // Initialize media library for unit tests. If we are auto test |
| + // (python process), media library will be loaded to chrome directly |
| + // so don't load it here. |
| + if (!IsPythonProcess()) |
| + media::InitializeMediaLibraryForTesting(); |
| scoped_ptr<ContentClient> client_for_init(CreateClientForInitialization()); |
| SetContentClient(client_for_init.get()); |