OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/test/launcher/unit_test_launcher.h" | 9 #include "base/test/launcher/unit_test_launcher.h" |
10 #include "base/test/test_discardable_memory_shmem_allocator.h" | |
11 #include "base/test/test_suite.h" | 10 #include "base/test/test_suite.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
14 #include "ui/base/ui_base_paths.h" | 13 #include "ui/base/ui_base_paths.h" |
15 | 14 |
16 #if defined(OS_MACOSX) | 15 #if defined(OS_MACOSX) |
17 #include "base/test/mock_chrome_application_mac.h" | 16 #include "base/test/mock_chrome_application_mac.h" |
18 #else | 17 #else |
19 #include "ui/gl/gl_surface.h" | 18 #include "ui/gl/gl_surface.h" |
20 #endif | 19 #endif |
(...skipping 10 matching lines...) Expand all Loading... |
31 mock_cr_app::RegisterMockCrApp(); | 30 mock_cr_app::RegisterMockCrApp(); |
32 #else | 31 #else |
33 gfx::GLSurface::InitializeOneOffForTests(); | 32 gfx::GLSurface::InitializeOneOffForTests(); |
34 #endif | 33 #endif |
35 base::TestSuite::Initialize(); | 34 base::TestSuite::Initialize(); |
36 ui::RegisterPathProvider(); | 35 ui::RegisterPathProvider(); |
37 | 36 |
38 base::FilePath ui_test_pak_path; | 37 base::FilePath ui_test_pak_path; |
39 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); | 38 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); |
40 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); | 39 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); |
41 | |
42 base::DiscardableMemoryShmemAllocator::SetInstance( | |
43 &discardable_memory_allocator_); | |
44 } | 40 } |
45 | 41 |
46 void Shutdown() override { | 42 void Shutdown() override { |
47 ui::ResourceBundle::CleanupSharedInstance(); | 43 ui::ResourceBundle::CleanupSharedInstance(); |
48 base::TestSuite::Shutdown(); | 44 base::TestSuite::Shutdown(); |
49 } | 45 } |
50 | 46 |
51 private: | 47 private: |
52 base::TestDiscardableMemoryShmemAllocator discardable_memory_allocator_; | |
53 | |
54 DISALLOW_COPY_AND_ASSIGN(MessageCenterTestSuite); | 48 DISALLOW_COPY_AND_ASSIGN(MessageCenterTestSuite); |
55 }; | 49 }; |
56 | 50 |
57 } // namespace | 51 } // namespace |
58 | 52 |
59 int main(int argc, char** argv) { | 53 int main(int argc, char** argv) { |
60 MessageCenterTestSuite test_suite(argc, argv); | 54 MessageCenterTestSuite test_suite(argc, argv); |
61 | 55 |
62 return base::LaunchUnitTests( | 56 return base::LaunchUnitTests( |
63 argc, | 57 argc, |
64 argv, | 58 argv, |
65 base::Bind(&MessageCenterTestSuite::Run, base::Unretained(&test_suite))); | 59 base::Bind(&MessageCenterTestSuite::Run, base::Unretained(&test_suite))); |
66 } | 60 } |
OLD | NEW |