Chromium Code Reviews| 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/basictypes.h" | |
| 6 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/test/launcher/unit_test_launcher.h" | 9 #include "base/test/launcher/unit_test_launcher.h" |
| 10 #include "base/test/test_suite.h" | 10 #include "base/test/test_suite.h" |
| 11 #include "ui/base/resource/resource_bundle.h" | 11 #include "ui/base/resource/resource_bundle.h" |
| 12 #include "ui/base/ui_base_paths.h" | 12 #include "ui/base/ui_base_paths.h" |
| 13 #include "ui/base/ui_base_switches.h" | |
| 14 #include "ui/gl/gl_surface.h" | |
| 13 | 15 |
| 14 #if !defined(OS_MACOSX) | 16 class WebViewTestSuite : public base::TestSuite { |
| 15 #include "ui/gl/gl_surface.h" | |
| 16 #endif | |
| 17 | |
| 18 namespace { | |
| 19 | |
| 20 class AppListTestSuite : public base::TestSuite { | |
| 21 public: | 17 public: |
| 22 AppListTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} | 18 WebViewTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} |
| 23 | 19 |
| 24 protected: | 20 protected: |
| 25 virtual void Initialize() OVERRIDE { | 21 virtual void Initialize() OVERRIDE { |
| 26 #if !defined(OS_MACOSX) | 22 base::TestSuite::Initialize(); |
| 27 gfx::GLSurface::InitializeOneOffForTests(); | 23 gfx::GLSurface::InitializeOneOffForTests(); |
| 28 #endif | |
| 29 base::TestSuite::Initialize(); | |
| 30 ui::RegisterPathProvider(); | 24 ui::RegisterPathProvider(); |
| 31 | 25 |
| 32 base::FilePath pak_dir; | 26 base::FilePath pak_dir; |
| 33 PathService::Get(base::DIR_MODULE, &pak_dir); | 27 PathService::Get(base::DIR_MODULE, &pak_dir); |
| 34 | 28 |
| 35 base::FilePath pak_file; | 29 base::FilePath pak_file; |
| 36 pak_file = pak_dir.Append(FILE_PATH_LITERAL("ui_test.pak")); | 30 pak_file = pak_dir.Append(FILE_PATH_LITERAL("ui_test.pak")); |
| 37 | 31 |
| 38 ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file); | 32 ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file); |
| 39 } | 33 } |
| 40 | 34 |
| 41 virtual void Shutdown() OVERRIDE { | 35 virtual void Shutdown() OVERRIDE { |
| 42 ui::ResourceBundle::CleanupSharedInstance(); | 36 ui::ResourceBundle::CleanupSharedInstance(); |
| 43 base::TestSuite::Shutdown(); | 37 base::TestSuite::Shutdown(); |
| 44 } | 38 } |
| 45 | 39 |
| 46 private: | 40 private: |
| 47 DISALLOW_COPY_AND_ASSIGN(AppListTestSuite); | 41 DISALLOW_COPY_AND_ASSIGN(WebViewTestSuite); |
| 48 }; | 42 }; |
| 49 | 43 |
| 50 } // namespace | 44 int main(int argc, char** argv) { |
| 45 base::CommandLine::Init(argc, argv); | |
| 46 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | |
| 47 cmd_line->AppendSwitch(switches::kEnableTextInputFocusManager); | |
|
msw
2014/04/22 17:12:56
Can this be done in webview_unittest.cc?
Yuki
2014/04/23 03:53:40
Done.
| |
| 51 | 48 |
| 52 int main(int argc, char** argv) { | 49 WebViewTestSuite test_suite(argc, argv); |
| 53 AppListTestSuite test_suite(argc, argv); | |
| 54 | 50 |
| 55 return base::LaunchUnitTests( | 51 return base::LaunchUnitTests( |
| 56 argc, | 52 argc, argv, base::Bind(&WebViewTestSuite::Run, |
| 57 argv, | 53 base::Unretained(&test_suite))); |
| 58 base::Bind(&AppListTestSuite::Run, base::Unretained(&test_suite))); | |
| 59 } | 54 } |
| OLD | NEW |