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