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

Side by Side Diff: content/test/content_test_suite.cc

Issue 10807064: Revert 147799 - landed without owners approval (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/test/content_test_suite_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/test/content_test_suite.h" 5 #include "content/test/content_test_suite.h"
6 6
7 #if defined(OS_CHROMEOS)
8 #include <stdio.h>
9 #include <unistd.h>
10 #endif
11
12 #include "base/logging.h" 7 #include "base/logging.h"
13 #include "content/public/test/test_content_client_initializer.h" 8 #include "content/public/test/test_content_client_initializer.h"
14 #include "content/test/test_content_client.h" 9 #include "content/test/test_content_client.h"
15 #include "media/base/media.h"
16 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
17 11
18 #if defined(USE_AURA) 12 #if defined(USE_AURA)
19 #include "ui/aura/test/test_aura_initializer.h" 13 #include "ui/aura/test/test_aura_initializer.h"
20 #endif 14 #endif
21 15
22 #if defined(OS_MACOSX) 16 #if defined(OS_MACOSX)
23 #include "base/mac/scoped_nsautorelease_pool.h" 17 #include "base/mac/scoped_nsautorelease_pool.h"
24 #endif 18 #endif
25 19
(...skipping 26 matching lines...) Expand all
52 ContentTestSuite::ContentTestSuite(int argc, char** argv) 46 ContentTestSuite::ContentTestSuite(int argc, char** argv)
53 : ContentTestSuiteBase(argc, argv) { 47 : ContentTestSuiteBase(argc, argv) {
54 #if defined(USE_AURA) 48 #if defined(USE_AURA)
55 aura_initializer_.reset(new aura::test::TestAuraInitializer); 49 aura_initializer_.reset(new aura::test::TestAuraInitializer);
56 #endif 50 #endif
57 } 51 }
58 52
59 ContentTestSuite::~ContentTestSuite() { 53 ContentTestSuite::~ContentTestSuite() {
60 } 54 }
61 55
62 static bool IsCrosPythonProcess() {
63 #if defined(OS_CHROMEOS)
64 char buf[80];
65 int num_read = readlink("/proc/self/exe", buf, sizeof(buf) - 1);
66 if (num_read == -1)
67 return false;
68 buf[num_read] = 0;
69 const char kPythonPrefix[] = "/python";
70 return !strncmp(strrchr(buf, '/'), kPythonPrefix, sizeof(kPythonPrefix) - 1);
71 #endif // defined(OS_CHROMEOS)
72 return false;
73 }
74
75 void ContentTestSuite::Initialize() { 56 void ContentTestSuite::Initialize() {
76 #if defined(OS_MACOSX) 57 #if defined(OS_MACOSX)
77 base::mac::ScopedNSAutoreleasePool autorelease_pool; 58 base::mac::ScopedNSAutoreleasePool autorelease_pool;
78 #endif 59 #endif
79 60
80 ContentTestSuiteBase::Initialize(); 61 ContentTestSuiteBase::Initialize();
81 62
82 // Initialize media library for unit tests. If we are auto test
83 // (python process under chrome os), media library will be loaded to
84 // chrome directly so don't load it here.
85 if (!IsCrosPythonProcess())
86 media::InitializeMediaLibraryForTesting();
87
88 testing::TestEventListeners& listeners = 63 testing::TestEventListeners& listeners =
89 testing::UnitTest::GetInstance()->listeners(); 64 testing::UnitTest::GetInstance()->listeners();
90 listeners.Append(new TestInitializationListener); 65 listeners.Append(new TestInitializationListener);
91 } 66 }
92 67
93 ContentClient* ContentTestSuite::CreateClientForInitialization() { 68 ContentClient* ContentTestSuite::CreateClientForInitialization() {
94 return new TestContentClient(); 69 return new TestContentClient();
95 } 70 }
96 71
97 } // namespace content 72 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/test/content_test_suite_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698