Get foreground tab on Android
[chromium-blink-merge.git] / content / test / content_test_suite.cc
blob1fc9d3590d5ba4a2dd7895842186b1337481515b
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"
12 #if defined(USE_AURA)
13 #include "ui/aura/test/test_aura_initializer.h"
14 #endif
16 #if defined(OS_MACOSX)
17 #include "base/mac/scoped_nsautorelease_pool.h"
18 #endif
20 namespace {
22 class TestInitializationListener : public testing::EmptyTestEventListener {
23 public:
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_;
36 private:
37 content::TestContentClientInitializer* test_content_client_initializer_;
39 DISALLOW_COPY_AND_ASSIGN(TestInitializationListener);
42 } // namespace
44 namespace content {
46 ContentTestSuite::ContentTestSuite(int argc, char** argv)
47 : ContentTestSuiteBase(argc, argv) {
48 #if defined(USE_AURA)
49 aura_initializer_.reset(new aura::test::TestAuraInitializer);
50 #endif
53 ContentTestSuite::~ContentTestSuite() {
56 void ContentTestSuite::Initialize() {
57 #if defined(OS_MACOSX)
58 base::mac::ScopedNSAutoreleasePool autorelease_pool;
59 #endif
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