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/android/jni_android.h"
7 #include "base/compiler_specific.h"
8 #include "base/macros.h"
9 #include "base/path_service.h"
10 #include "base/test/launcher/unit_test_launcher.h"
11 #include "base/test/test_suite.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "ui/android/ui_android_jni_registrar.h"
14 #include "ui/base/resource/resource_bundle.h"
15 #include "ui/base/ui_base_paths.h"
16 #include "ui/gfx/android/gfx_jni_registrar.h"
20 class UIAndroidTestSuite
: public base::TestSuite
{
22 UIAndroidTestSuite(int argc
, char** argv
) : base::TestSuite(argc
, argv
) {}
25 void Initialize() override
{
26 base::TestSuite::Initialize();
28 gfx::android::RegisterJni(base::android::AttachCurrentThread());
29 ui::RegisterUIAndroidJni(base::android::AttachCurrentThread());
31 ui::RegisterPathProvider();
33 base::FilePath ui_test_pak_path
;
34 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK
, &ui_test_pak_path
));
35 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path
);
38 void Shutdown() override
{
39 ui::ResourceBundle::CleanupSharedInstance();
40 base::TestSuite::Shutdown();
44 DISALLOW_COPY_AND_ASSIGN(UIAndroidTestSuite
);
49 int main(int argc
, char** argv
) {
50 UIAndroidTestSuite
test_suite(argc
, argv
);
52 return base::LaunchUnitTests(
54 base::Bind(&UIAndroidTestSuite::Run
, base::Unretained(&test_suite
)));