| 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/base_paths.h" |
| 5 #include "base/bind.h" | 6 #include "base/bind.h" |
| 6 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/path_service.h" |
| 7 #include "base/test/launcher/unit_test_launcher.h" | 9 #include "base/test/launcher/unit_test_launcher.h" |
| 8 #include "base/test/test_suite.h" | 10 #include "base/test/test_suite.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
| 11 #include "ui/base/ui_base_paths.h" | 13 #include "ui/base/ui_base_paths.h" |
| 12 #include "ui/gfx/gfx_paths.h" | 14 #include "ui/gfx/gfx_paths.h" |
| 13 #include "ui/gl/gl_surface.h" | 15 #include "ui/gl/gl_surface.h" |
| 14 | 16 |
| 15 namespace { | 17 namespace { |
| 16 | 18 |
| 17 class AthenaTestSuite : public base::TestSuite { | 19 class AthenaTestSuite : public base::TestSuite { |
| 18 public: | 20 public: |
| 19 AthenaTestSuite(int argc, char** argv) : TestSuite(argc, argv) {} | 21 AthenaTestSuite(int argc, char** argv) : TestSuite(argc, argv) {} |
| 20 virtual ~AthenaTestSuite() {} | 22 virtual ~AthenaTestSuite() {} |
| 21 | 23 |
| 22 protected: | 24 protected: |
| 23 // base::TestSuite: | 25 // base::TestSuite: |
| 24 virtual void Initialize() OVERRIDE { | 26 virtual void Initialize() OVERRIDE { |
| 25 base::TestSuite::Initialize(); | 27 base::TestSuite::Initialize(); |
| 26 gfx::GLSurface::InitializeOneOffForTests(); | 28 gfx::GLSurface::InitializeOneOffForTests(); |
| 27 gfx::RegisterPathProvider(); | 29 gfx::RegisterPathProvider(); |
| 28 ui::RegisterPathProvider(); | 30 ui::RegisterPathProvider(); |
| 29 | 31 |
| 30 // Force unittests to run using en-US so if we test against string | 32 base::FilePath test_pak_path; |
| 31 // output, it'll pass regardless of the system language. | 33 ASSERT_TRUE(PathService::Get(base::DIR_MODULE, &test_pak_path)); |
| 32 ui::ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); | 34 test_pak_path = test_pak_path.AppendASCII("athena_resources.pak"); |
| 35 ui::ResourceBundle::InitSharedInstanceWithPakPath(test_pak_path); |
| 33 } | 36 } |
| 34 virtual void Shutdown() OVERRIDE { | 37 virtual void Shutdown() OVERRIDE { |
| 35 ui::ResourceBundle::CleanupSharedInstance(); | 38 ui::ResourceBundle::CleanupSharedInstance(); |
| 36 base::TestSuite::Shutdown(); | 39 base::TestSuite::Shutdown(); |
| 37 } | 40 } |
| 38 | 41 |
| 39 private: | 42 private: |
| 40 DISALLOW_COPY_AND_ASSIGN(AthenaTestSuite); | 43 DISALLOW_COPY_AND_ASSIGN(AthenaTestSuite); |
| 41 }; | 44 }; |
| 42 | 45 |
| 43 } // namespace | 46 } // namespace |
| 44 | 47 |
| 45 int main(int argc, char** argv) { | 48 int main(int argc, char** argv) { |
| 46 AthenaTestSuite test_suite(argc, argv); | 49 AthenaTestSuite test_suite(argc, argv); |
| 47 | 50 |
| 48 return base::LaunchUnitTestsSerially( | 51 return base::LaunchUnitTestsSerially( |
| 49 argc, | 52 argc, |
| 50 argv, | 53 argv, |
| 51 base::Bind(&AthenaTestSuite::Run, base::Unretained(&test_suite))); | 54 base::Bind(&AthenaTestSuite::Run, base::Unretained(&test_suite))); |
| 52 } | 55 } |
| OLD | NEW |