OLD | NEW |
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 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
| 8 #include "base/base_switches.h" |
| 9 #include "base/command_line.h" |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
9 #include "base/path_service.h" | 11 #include "base/path_service.h" |
10 #include "content/public/test/test_content_client_initializer.h" | 12 #include "content/public/test/test_content_client_initializer.h" |
11 #include "content/test/test_content_client.h" | 13 #include "content/test/test_content_client.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
14 | 16 |
| 17 #if !defined(OS_IOS) |
| 18 #include "ui/gl/gl_surface.h" |
| 19 #endif |
| 20 |
15 #if defined(OS_MACOSX) | 21 #if defined(OS_MACOSX) |
16 #include "base/mac/scoped_nsautorelease_pool.h" | 22 #include "base/mac/scoped_nsautorelease_pool.h" |
17 #endif | 23 #endif |
18 | 24 |
19 namespace { | 25 namespace { |
20 | 26 |
21 class TestInitializationListener : public testing::EmptyTestEventListener { | 27 class TestInitializationListener : public testing::EmptyTestEventListener { |
22 public: | 28 public: |
23 TestInitializationListener() : test_content_client_initializer_(NULL) { | 29 TestInitializationListener() : test_content_client_initializer_(NULL) { |
24 } | 30 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 #endif | 64 #endif |
59 } | 65 } |
60 | 66 |
61 void ContentTestSuite::Initialize() { | 67 void ContentTestSuite::Initialize() { |
62 #if defined(OS_MACOSX) | 68 #if defined(OS_MACOSX) |
63 base::mac::ScopedNSAutoreleasePool autorelease_pool; | 69 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
64 #endif | 70 #endif |
65 | 71 |
66 ContentTestSuiteBase::Initialize(); | 72 ContentTestSuiteBase::Initialize(); |
67 | 73 |
| 74 #if !defined(OS_IOS) |
| 75 // When running in a child process for Mac sandbox tests, the sandbox exists |
| 76 // to initialize GL, so don't do it here. |
| 77 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestChildProcess)) |
| 78 gfx::GLSurface::InitializeOneOffForTests(); |
| 79 #endif |
| 80 |
68 testing::TestEventListeners& listeners = | 81 testing::TestEventListeners& listeners = |
69 testing::UnitTest::GetInstance()->listeners(); | 82 testing::UnitTest::GetInstance()->listeners(); |
70 listeners.Append(new TestInitializationListener); | 83 listeners.Append(new TestInitializationListener); |
71 } | 84 } |
72 | 85 |
73 ContentClient* ContentTestSuite::CreateClientForInitialization() { | 86 ContentClient* ContentTestSuite::CreateClientForInitialization() { |
74 return new TestContentClient(); | 87 return new TestContentClient(); |
75 } | 88 } |
76 | 89 |
77 } // namespace content | 90 } // namespace content |
OLD | NEW |