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

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

Issue 135213003: Ensure GL initialization only happens once, and provide common init path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: initgl: compile3 Created 6 years, 10 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 | « content/public/common/content_switches.cc ('k') | gpu/command_buffer/common/unittest_main.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 #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
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
OLDNEW
« no previous file with comments | « content/public/common/content_switches.cc ('k') | gpu/command_buffer/common/unittest_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698