| 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" | |
| 10 #include "base/logging.h" | 8 #include "base/logging.h" |
| 11 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 12 #include "content/public/test/test_content_client_initializer.h" | 10 #include "content/public/test/test_content_client_initializer.h" |
| 13 #include "content/test/test_content_client.h" | 11 #include "content/test/test_content_client.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
| 16 | 14 |
| 17 #if !defined(OS_IOS) | |
| 18 #include "ui/gl/gl_surface.h" | |
| 19 #endif | |
| 20 | |
| 21 #if defined(OS_MACOSX) | 15 #if defined(OS_MACOSX) |
| 22 #include "base/mac/scoped_nsautorelease_pool.h" | 16 #include "base/mac/scoped_nsautorelease_pool.h" |
| 23 #endif | 17 #endif |
| 24 | 18 |
| 25 namespace { | 19 namespace { |
| 26 | 20 |
| 27 class TestInitializationListener : public testing::EmptyTestEventListener { | 21 class TestInitializationListener : public testing::EmptyTestEventListener { |
| 28 public: | 22 public: |
| 29 TestInitializationListener() : test_content_client_initializer_(NULL) { | 23 TestInitializationListener() : test_content_client_initializer_(NULL) { |
| 30 } | 24 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 #endif | 58 #endif |
| 65 } | 59 } |
| 66 | 60 |
| 67 void ContentTestSuite::Initialize() { | 61 void ContentTestSuite::Initialize() { |
| 68 #if defined(OS_MACOSX) | 62 #if defined(OS_MACOSX) |
| 69 base::mac::ScopedNSAutoreleasePool autorelease_pool; | 63 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
| 70 #endif | 64 #endif |
| 71 | 65 |
| 72 ContentTestSuiteBase::Initialize(); | 66 ContentTestSuiteBase::Initialize(); |
| 73 | 67 |
| 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 | |
| 81 testing::TestEventListeners& listeners = | 68 testing::TestEventListeners& listeners = |
| 82 testing::UnitTest::GetInstance()->listeners(); | 69 testing::UnitTest::GetInstance()->listeners(); |
| 83 listeners.Append(new TestInitializationListener); | 70 listeners.Append(new TestInitializationListener); |
| 84 } | 71 } |
| 85 | 72 |
| 86 ContentClient* ContentTestSuite::CreateClientForInitialization() { | 73 ContentClient* ContentTestSuite::CreateClientForInitialization() { |
| 87 return new TestContentClient(); | 74 return new TestContentClient(); |
| 88 } | 75 } |
| 89 | 76 |
| 90 } // namespace content | 77 } // namespace content |
| OLD | NEW |