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

Unified Diff: content/test/content_test_suite_base.cc

Issue 10786038: Prevent loading libffmpegsumo.so to python (autotests) process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698