1 // Copyright 2014 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 "base/basictypes.h"
7 #include "base/compiler_specific.h"
8 #include "base/path_service.h"
9 #include "base/test/launcher/unit_test_launcher.h"
10 #include "base/test/test_discardable_memory_allocator.h"
11 #include "base/test/test_suite.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"
16 #if defined(OS_MACOSX)
17 #include "base/test/mock_chrome_application_mac.h"
20 #if defined(TOOLKIT_VIEWS)
21 #include "ui/gl/gl_surface.h"
26 class AppListTestSuite
: public base::TestSuite
{
28 AppListTestSuite(int argc
, char** argv
) : base::TestSuite(argc
, argv
) {}
31 void Initialize() override
{
32 #if defined(OS_MACOSX)
33 mock_cr_app::RegisterMockCrApp();
35 #if defined(TOOLKIT_VIEWS)
36 gfx::GLSurface::InitializeOneOffForTests();
38 base::TestSuite::Initialize();
39 ui::RegisterPathProvider();
41 base::FilePath ui_test_pak_path
;
42 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK
, &ui_test_pak_path
));
43 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path
);
45 base::DiscardableMemoryAllocator::SetInstance(
46 &discardable_memory_allocator_
);
49 void Shutdown() override
{
50 ui::ResourceBundle::CleanupSharedInstance();
51 base::TestSuite::Shutdown();
55 base::TestDiscardableMemoryAllocator discardable_memory_allocator_
;
57 DISALLOW_COPY_AND_ASSIGN(AppListTestSuite
);
62 int main(int argc
, char** argv
) {
63 AppListTestSuite
test_suite(argc
, argv
);
65 return base::LaunchUnitTests(
68 base::Bind(&AppListTestSuite::Run
, base::Unretained(&test_suite
)));