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_suite.h" | 10 #include "base/test/test_suite.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
13 #include "ui/base/ui_base_paths.h" | 13 #include "ui/base/ui_base_paths.h" |
14 | 14 |
15 #if defined(OS_MACOSX) | 15 #if defined(OS_MACOSX) |
16 #include "base/test/mock_chrome_application_mac.h" | 16 #include "base/test/mock_chrome_application_mac.h" |
17 #else | 17 #else |
18 #include "ui/gl/gl_surface.h" | 18 #include "ui/gl/gl_surface.h" |
19 #endif | 19 #endif |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 class MessageCenterTestSuite : public base::TestSuite { | 23 class MessageCenterTestSuite : public base::TestSuite { |
24 public: | 24 public: |
25 MessageCenterTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} | 25 MessageCenterTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} |
26 | 26 |
27 protected: | 27 protected: |
28 virtual void Initialize() override { | 28 void Initialize() override { |
29 #if defined(OS_MACOSX) | 29 #if defined(OS_MACOSX) |
30 mock_cr_app::RegisterMockCrApp(); | 30 mock_cr_app::RegisterMockCrApp(); |
31 #else | 31 #else |
32 gfx::GLSurface::InitializeOneOffForTests(); | 32 gfx::GLSurface::InitializeOneOffForTests(); |
33 #endif | 33 #endif |
34 base::TestSuite::Initialize(); | 34 base::TestSuite::Initialize(); |
35 ui::RegisterPathProvider(); | 35 ui::RegisterPathProvider(); |
36 | 36 |
37 base::FilePath ui_test_pak_path; | 37 base::FilePath ui_test_pak_path; |
38 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)); |
39 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); | 39 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); |
40 } | 40 } |
41 | 41 |
42 virtual void Shutdown() override { | 42 void Shutdown() override { |
43 ui::ResourceBundle::CleanupSharedInstance(); | 43 ui::ResourceBundle::CleanupSharedInstance(); |
44 base::TestSuite::Shutdown(); | 44 base::TestSuite::Shutdown(); |
45 } | 45 } |
46 | 46 |
47 private: | 47 private: |
48 DISALLOW_COPY_AND_ASSIGN(MessageCenterTestSuite); | 48 DISALLOW_COPY_AND_ASSIGN(MessageCenterTestSuite); |
49 }; | 49 }; |
50 | 50 |
51 } // namespace | 51 } // namespace |
52 | 52 |
53 int main(int argc, char** argv) { | 53 int main(int argc, char** argv) { |
54 MessageCenterTestSuite test_suite(argc, argv); | 54 MessageCenterTestSuite test_suite(argc, argv); |
55 | 55 |
56 return base::LaunchUnitTests( | 56 return base::LaunchUnitTests( |
57 argc, | 57 argc, |
58 argv, | 58 argv, |
59 base::Bind(&MessageCenterTestSuite::Run, base::Unretained(&test_suite))); | 59 base::Bind(&MessageCenterTestSuite::Run, base::Unretained(&test_suite))); |
60 } | 60 } |
OLD | NEW |