| 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/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/test/launcher/unit_test_launcher.h" | 10 #include "base/test/launcher/unit_test_launcher.h" |
| 11 #include "base/test/test_discardable_memory_allocator.h" | 11 #include "base/test/test_discardable_memory_allocator.h" |
| 12 #include "base/test/test_suite.h" | 12 #include "base/test/test_suite.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
| 16 #include "ui/base/ui_base_paths.h" | 16 #include "ui/base/ui_base_paths.h" |
| 17 | |
| 18 #if defined(OS_MACOSX) | |
| 19 #include "base/test/mock_chrome_application_mac.h" | |
| 20 #endif | |
| 21 | |
| 22 #if defined(TOOLKIT_VIEWS) | |
| 23 #include "ui/gl/test/gl_surface_test_support.h" | 17 #include "ui/gl/test/gl_surface_test_support.h" |
| 24 #endif | |
| 25 | 18 |
| 26 namespace { | 19 namespace { |
| 27 | 20 |
| 28 // Use the pattern established in content_switches.h, but don't add a content | 21 // Use the pattern established in content_switches.h, but don't add a content |
| 29 // dependency -- app list shouldn't have one. | 22 // dependency -- app list shouldn't have one. |
| 30 const char kTestType[] = "test-type"; | 23 const char kTestType[] = "test-type"; |
| 31 | 24 |
| 32 class AppListTestSuite : public base::TestSuite { | 25 class AppListTestSuite : public base::TestSuite { |
| 33 public: | 26 public: |
| 34 AppListTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} | 27 AppListTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} |
| 35 | 28 |
| 36 protected: | 29 protected: |
| 37 void Initialize() override { | 30 void Initialize() override { |
| 38 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 31 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 39 command_line->AppendSwitchASCII(kTestType, "applist"); | 32 command_line->AppendSwitchASCII(kTestType, "applist"); |
| 40 | 33 |
| 41 #if defined(OS_MACOSX) | |
| 42 mock_cr_app::RegisterMockCrApp(); | |
| 43 #endif | |
| 44 #if defined(TOOLKIT_VIEWS) | |
| 45 gl::GLSurfaceTestSupport::InitializeOneOff(); | 34 gl::GLSurfaceTestSupport::InitializeOneOff(); |
| 46 #endif | |
| 47 base::TestSuite::Initialize(); | 35 base::TestSuite::Initialize(); |
| 48 ui::RegisterPathProvider(); | 36 ui::RegisterPathProvider(); |
| 49 | 37 |
| 50 base::FilePath ui_test_pak_path; | 38 base::FilePath ui_test_pak_path; |
| 51 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); | 39 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); |
| 52 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); | 40 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); |
| 53 | 41 |
| 54 base::DiscardableMemoryAllocator::SetInstance( | 42 base::DiscardableMemoryAllocator::SetInstance( |
| 55 &discardable_memory_allocator_); | 43 &discardable_memory_allocator_); |
| 56 } | 44 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 69 } // namespace | 57 } // namespace |
| 70 | 58 |
| 71 int main(int argc, char** argv) { | 59 int main(int argc, char** argv) { |
| 72 AppListTestSuite test_suite(argc, argv); | 60 AppListTestSuite test_suite(argc, argv); |
| 73 | 61 |
| 74 return base::LaunchUnitTests( | 62 return base::LaunchUnitTests( |
| 75 argc, | 63 argc, |
| 76 argv, | 64 argv, |
| 77 base::Bind(&AppListTestSuite::Run, base::Unretained(&test_suite))); | 65 base::Bind(&AppListTestSuite::Run, base::Unretained(&test_suite))); |
| 78 } | 66 } |
| OLD | NEW |