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..6ae4939870dc09e384f45d41a29a3a5224bb69c9 100644 |
| --- a/content/test/content_test_suite_base.cc |
| +++ b/content/test/content_test_suite_base.cc |
| @@ -4,8 +4,12 @@ |
| #include "content/public/test/content_test_suite_base.h" |
| +#include <stdio.h> |
| +#include <unistd.h> |
|
scherkus (not reviewing)
2012/07/19 20:38:53
this doesn't exist on windows (compile failure)
glotov
2012/07/19 21:45:33
Done.
|
| + |
| #include "base/basictypes.h" |
| #include "base/compiler_specific.h" |
| +#include "base/eintr_wrapper.h" |
|
scherkus (not reviewing)
2012/07/19 20:38:53
this isn't used anymore
glotov
2012/07/19 21:45:33
Done.
|
| #include "base/memory/scoped_ptr.h" |
| #include "base/test/test_suite.h" |
| #include "content/common/url_schemes.h" |
| @@ -21,9 +25,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; |
| +} |
| + |
| 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()); |