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