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