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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/macros.h" | 7 #include "base/macros.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_ANDROID) | |
16 #include "base/android/jni_android.h" | |
17 #include "ui/gfx/android/gfx_jni_registrar.h" | |
18 #endif | |
19 | |
15 namespace { | 20 namespace { |
16 | 21 |
17 class GfxTestSuite : public base::TestSuite { | 22 class GfxTestSuite : public base::TestSuite { |
18 public: | 23 public: |
19 GfxTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} | 24 GfxTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} |
20 | 25 |
21 protected: | 26 protected: |
22 virtual void Initialize() OVERRIDE { | 27 virtual void Initialize() OVERRIDE { |
23 base::TestSuite::Initialize(); | 28 base::TestSuite::Initialize(); |
24 ui::RegisterPathProvider(); | 29 ui::RegisterPathProvider(); |
25 | 30 |
26 base::FilePath ui_test_pak_path; | 31 base::FilePath ui_test_pak_path; |
27 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); | 32 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); |
28 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); | 33 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); |
29 } | 34 } |
30 | 35 |
31 virtual void Shutdown() OVERRIDE { | 36 virtual void Shutdown() OVERRIDE { |
32 ui::ResourceBundle::CleanupSharedInstance(); | 37 ui::ResourceBundle::CleanupSharedInstance(); |
33 base::TestSuite::Shutdown(); | 38 base::TestSuite::Shutdown(); |
34 } | 39 } |
35 | 40 |
36 private: | 41 private: |
37 DISALLOW_COPY_AND_ASSIGN(GfxTestSuite); | 42 DISALLOW_COPY_AND_ASSIGN(GfxTestSuite); |
38 }; | 43 }; |
39 | 44 |
40 } // namespace | 45 } // namespace |
41 | 46 |
42 int main(int argc, char** argv) { | 47 int main(int argc, char** argv) { |
48 #if defined(OS_ANDROID) | |
49 gfx::android::RegisterJni(base::android::AttachCurrentThread()); | |
tfarina
2014/05/30 14:56:22
please, have this in GfxTestSuite::Initialize() an
bulach
2014/05/30 15:07:24
Done.
| |
50 #endif | |
43 GfxTestSuite test_suite(argc, argv); | 51 GfxTestSuite test_suite(argc, argv); |
44 | 52 |
45 return base::LaunchUnitTests( | 53 return base::LaunchUnitTests( |
46 argc, | 54 argc, |
47 argv, | 55 argv, |
48 base::Bind(&GfxTestSuite::Run, base::Unretained(&test_suite))); | 56 base::Bind(&GfxTestSuite::Run, base::Unretained(&test_suite))); |
49 } | 57 } |
OLD | NEW |