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

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..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());
« 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