test_suite.cc revision 868fa2fe829687343ffae624259930155e16dbd8
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. 4 5#include "ash/test/test_suite.h" 6 7#include "ash/ash_switches.h" 8#include "base/command_line.h" 9#include "base/files/file_path.h" 10#include "base/path_service.h" 11#include "build/build_config.h" 12#include "testing/gtest/include/gtest/gtest.h" 13#include "ui/base/resource/resource_bundle.h" 14#include "ui/base/ui_base_paths.h" 15#include "ui/compositor/compositor_setup.h" 16#include "ui/gfx/gfx_paths.h" 17 18#if defined(OS_MACOSX) 19#include "ash/test/test_suite_init.h" 20#endif 21 22#if defined(OS_WIN) 23#include "base/win/windows_version.h" 24#include "ui/base/win/atl_module.h" 25#include "win8/test/metro_registration_helper.h" 26#include "win8/test/test_registrar_constants.h" 27#endif 28 29namespace ash { 30namespace test { 31 32AuraShellTestSuite::AuraShellTestSuite(int argc, char** argv) 33 : TestSuite(argc, argv) {} 34 35void AuraShellTestSuite::Initialize() { 36 base::TestSuite::Initialize(); 37 38#if defined(OS_WIN) 39 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && 40 !CommandLine::ForCurrentProcess()->HasSwitch( 41 ash::switches::kForceAshToDesktop)) { 42 com_initializer_.reset(new base::win::ScopedCOMInitializer()); 43 ui::win::CreateATLModuleIfNeeded(); 44 ASSERT_TRUE(win8::MakeTestDefaultBrowserSynchronously()); 45 } 46#endif 47 48 gfx::RegisterPathProvider(); 49 ui::RegisterPathProvider(); 50 51#if defined(OS_MACOSX) 52 ash::test::OverrideFrameworkBundle(); 53#endif 54 55 // Force unittests to run using en-US so if we test against string 56 // output, it'll pass regardless of the system language. 57 ui::ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); 58 ui::SetupTestCompositor(); 59} 60 61void AuraShellTestSuite::Shutdown() { 62 ui::ResourceBundle::CleanupSharedInstance(); 63#if defined(OS_WIN) 64 com_initializer_.reset(); 65#endif 66 base::TestSuite::Shutdown(); 67} 68 69} // namespace test 70} // namespace ash 71