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
3 // found in the LICENSE file.
5 #include "content/test/content_test_suite.h"
7 #include "base/logging.h"
8 #include "content/public/test/test_content_client_initializer.h"
9 #include "content/test/test_content_client.h"
10 #include "testing/gtest/include/gtest/gtest.h"
13 #include "ui/aura/test/test_aura_initializer.h"
16 #if defined(OS_MACOSX)
17 #include "base/mac/scoped_nsautorelease_pool.h"
22 class TestInitializationListener
: public testing::EmptyTestEventListener
{
24 TestInitializationListener() : test_content_client_initializer_(NULL
) {
27 virtual void OnTestStart(const testing::TestInfo
& test_info
) OVERRIDE
{
28 test_content_client_initializer_
=
29 new content::TestContentClientInitializer();
32 virtual void OnTestEnd(const testing::TestInfo
& test_info
) OVERRIDE
{
33 delete test_content_client_initializer_
;
37 content::TestContentClientInitializer
* test_content_client_initializer_
;
39 DISALLOW_COPY_AND_ASSIGN(TestInitializationListener
);
46 ContentTestSuite::ContentTestSuite(int argc
, char** argv
)
47 : ContentTestSuiteBase(argc
, argv
) {
49 aura_initializer_
.reset(new aura::test::TestAuraInitializer
);
53 ContentTestSuite::~ContentTestSuite() {
56 void ContentTestSuite::Initialize() {
57 #if defined(OS_MACOSX)
58 base::mac::ScopedNSAutoreleasePool autorelease_pool
;
61 ContentTestSuiteBase::Initialize();
63 testing::TestEventListeners
& listeners
=
64 testing::UnitTest::GetInstance()->listeners();
65 listeners
.Append(new TestInitializationListener
);
68 ContentClient
* ContentTestSuite::CreateClientForInitialization() {
69 return new TestContentClient();
72 } // namespace content