blob: 80d61f4fb4429f51cc7aa7ae5e65ca5ba1cfa7ef [file] [log] [blame]
[email protected]578c81b2012-01-27 07:25:021// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]2b99f8c2011-10-11 19:42:242// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]2f744282011-12-23 22:40:525#include "ash/test/test_suite.h"
[email protected]2b99f8c2011-10-11 19:42:246
[email protected]e9a3b0cf2013-03-25 20:23:417#include "ash/ash_switches.h"
8#include "base/command_line.h"
[email protected]57999812013-02-24 05:40:529#include "base/files/file_path.h"
[email protected]2b99f8c2011-10-11 19:42:2410#include "build/build_config.h"
[email protected]41168e22013-02-13 18:25:4311#include "testing/gtest/include/gtest/gtest.h"
[email protected]2b99f8c2011-10-11 19:42:2412#include "ui/base/resource/resource_bundle.h"
13#include "ui/base/ui_base_paths.h"
14#include "ui/gfx/gfx_paths.h"
[email protected]698bdb62014-02-22 08:14:5515#include "ui/gl/gl_surface.h"
[email protected]72f08de2011-12-09 16:19:0316
[email protected]1c3f7002013-01-21 18:46:0517#if defined(OS_WIN)
18#include "base/win/windows_version.h"
[email protected]41168e22013-02-13 18:25:4319#include "ui/base/win/atl_module.h"
20#include "win8/test/metro_registration_helper.h"
[email protected]41168e22013-02-13 18:25:4321#include "win8/test/test_registrar_constants.h"
[email protected]1c3f7002013-01-21 18:46:0522#endif
23
[email protected]55f593352011-12-24 05:42:4624namespace ash {
[email protected]6377a002011-11-10 20:26:4725namespace test {
26
[email protected]2b99f8c2011-10-11 19:42:2427AuraShellTestSuite::AuraShellTestSuite(int argc, char** argv)
28 : TestSuite(argc, argv) {}
29
30void AuraShellTestSuite::Initialize() {
[email protected]2b99f8c2011-10-11 19:42:2431 base::TestSuite::Initialize();
[email protected]f14a8a42014-03-04 21:52:1732 gfx::GLSurface::InitializeOneOffForTests();
[email protected]2b99f8c2011-10-11 19:42:2433
[email protected]41168e22013-02-13 18:25:4334#if defined(OS_WIN)
[email protected]cb1782c22014-03-12 19:44:0535 base::win::Version version = base::win::GetVersion();
36 // Although Ash officially is only supported for users on Win7+, we still run
37 // ash_unittests on Vista builders, so we still need to initialize COM.
38 if (version >= base::win::VERSION_VISTA &&
pgal.u-szegedd84534d32014-10-29 12:34:3039 !base::CommandLine::ForCurrentProcess()->HasSwitch(
[email protected]e9a3b0cf2013-03-25 20:23:4140 ash::switches::kForceAshToDesktop)) {
[email protected]b84f821c2013-05-28 17:56:0941 com_initializer_.reset(new base::win::ScopedCOMInitializer());
[email protected]41168e22013-02-13 18:25:4342 ui::win::CreateATLModuleIfNeeded();
[email protected]cb1782c22014-03-12 19:44:0543 if (version >= base::win::VERSION_WIN8)
44 ASSERT_TRUE(win8::MakeTestDefaultBrowserSynchronously());
[email protected]41168e22013-02-13 18:25:4345 }
46#endif
47
[email protected]2b99f8c2011-10-11 19:42:2448 gfx::RegisterPathProvider();
49 ui::RegisterPathProvider();
50
51 // Force unittests to run using en-US so if we test against string
52 // output, it'll pass regardless of the system language.
[email protected]4ce2aa62014-08-14 01:05:4953 ui::ResourceBundle::InitSharedInstanceWithLocale(
54 "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES);
reveman2799f7f2015-03-16 19:06:2155
56 base::DiscardableMemoryShmemAllocator::SetInstance(
57 &discardable_memory_allocator_);
[email protected]2b99f8c2011-10-11 19:42:2458}
59
60void AuraShellTestSuite::Shutdown() {
[email protected]2b99f8c2011-10-11 19:42:2461 ui::ResourceBundle::CleanupSharedInstance();
[email protected]b84f821c2013-05-28 17:56:0962#if defined(OS_WIN)
63 com_initializer_.reset();
64#endif
[email protected]2b99f8c2011-10-11 19:42:2465 base::TestSuite::Shutdown();
66}
[email protected]6377a002011-11-10 20:26:4767
68} // namespace test
[email protected]55f593352011-12-24 05:42:4669} // namespace ash