IndexedDBFactory now ForceCloses databases.
[chromium-blink-merge.git] / content / test / content_test_suite.cc
blob3618365785381ae5a2393e2ce64f893ba3d1f67c
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/base_paths.h"
8 #include "base/logging.h"
9 #include "base/path_service.h"
10 #include "content/public/test/test_content_client_initializer.h"
11 #include "content/test/test_content_client.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "ui/base/resource/resource_bundle.h"
15 #if defined(OS_MACOSX)
16 #include "base/mac/scoped_nsautorelease_pool.h"
17 #endif
19 namespace {
21 class TestInitializationListener : public testing::EmptyTestEventListener {
22 public:
23 TestInitializationListener() : test_content_client_initializer_(NULL) {
26 virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE {
27 test_content_client_initializer_ =
28 new content::TestContentClientInitializer();
31 virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE {
32 delete test_content_client_initializer_;
35 private:
36 content::TestContentClientInitializer* test_content_client_initializer_;
38 DISALLOW_COPY_AND_ASSIGN(TestInitializationListener);
41 } // namespace
43 namespace content {
45 ContentTestSuite::ContentTestSuite(int argc, char** argv)
46 : ContentTestSuiteBase(argc, argv) {
47 #if defined(USE_AURA)
48 base::FilePath pak_file;
49 PathService::Get(base::DIR_MODULE, &pak_file);
50 pak_file = pak_file.AppendASCII("ui_test.pak");
51 ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file);
52 #endif
55 ContentTestSuite::~ContentTestSuite() {
56 #if defined(USE_AURA)
57 ui::ResourceBundle::CleanupSharedInstance();
58 #endif
61 void ContentTestSuite::Initialize() {
62 #if defined(OS_MACOSX)
63 base::mac::ScopedNSAutoreleasePool autorelease_pool;
64 #endif
66 ContentTestSuiteBase::Initialize();
68 testing::TestEventListeners& listeners =
69 testing::UnitTest::GetInstance()->listeners();
70 listeners.Append(new TestInitializationListener);
73 ContentClient* ContentTestSuite::CreateClientForInitialization() {
74 return new TestContentClient();
77 } // namespace content