Fix race condition in gyp/ninja builds.
[chromium-blink-merge.git] / ui / gfx / test / run_all_unittests.cc
blob14ceef9ca4a5f79f9fd7806798683aa1037d3573
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/bind.h"
6 #include "base/compiler_specific.h"
7 #include "base/macros.h"
8 #include "base/path_service.h"
9 #include "base/test/launcher/unit_test_launcher.h"
10 #include "base/test/test_suite.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/base/resource/resource_bundle.h"
13 #include "ui/base/ui_base_paths.h"
15 #if defined(OS_ANDROID)
16 #include "base/android/jni_android.h"
17 #include "ui/gfx/android/gfx_jni_registrar.h"
18 #endif
20 namespace {
22 class GfxTestSuite : public base::TestSuite {
23 public:
24 GfxTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {}
26 protected:
27 virtual void Initialize() OVERRIDE {
28 base::TestSuite::Initialize();
30 #if defined(OS_ANDROID)
31 gfx::android::RegisterJni(base::android::AttachCurrentThread());
32 #endif
34 ui::RegisterPathProvider();
36 base::FilePath ui_test_pak_path;
37 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
38 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
41 virtual void Shutdown() OVERRIDE {
42 ui::ResourceBundle::CleanupSharedInstance();
43 base::TestSuite::Shutdown();
46 private:
47 DISALLOW_COPY_AND_ASSIGN(GfxTestSuite);
50 } // namespace
52 int main(int argc, char** argv) {
53 GfxTestSuite test_suite(argc, argv);
55 return base::LaunchUnitTests(
56 argc,
57 argv,
58 base::Bind(&GfxTestSuite::Run, base::Unretained(&test_suite)));