| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/test/base/chrome_test_launcher.h" | 5 #include "chrome/test/base/chrome_test_launcher.h" |
| 6 | 6 |
| 7 #include "chrome/test/base/chrome_test_suite.h" | 7 #include "chrome/test/base/chrome_test_suite.h" |
| 8 #include "ui/base/test/ui_controls.h" | 8 #include "ui/base/test/ui_controls.h" |
| 9 | 9 |
| 10 #if defined(USE_AURA) | 10 #if defined(USE_AURA) |
| 11 #include "ui/aura/test/ui_controls_factory_aura.h" | 11 #include "ui/aura/test/ui_controls_factory_aura.h" |
| 12 #include "ui/base/test/ui_controls_aura.h" | 12 #include "ui/base/test/ui_controls_aura.h" |
| 13 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 13 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 14 #include "ui/views/test/ui_controls_factory_desktop_aurax11.h" | 14 #include "ui/views/test/ui_controls_factory_desktop_aurax11.h" |
| 15 #endif | 15 #endif |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 #if defined(OS_CHROMEOS) | 18 #if defined(OS_CHROMEOS) |
| 19 #include "ash/test/ui_controls_factory_ash.h" | 19 #include "ash/test/ui_controls_factory_ash.h" |
| 20 #endif | 20 #endif |
| 21 | 21 |
| 22 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
| 23 #include "base/win/scoped_com_initializer.h" | 23 #include "base/win/scoped_com_initializer.h" |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 class InteractiveUITestSuite : public ChromeTestSuite { | 26 class InteractiveUITestSuite : public ChromeTestSuite { |
| 27 public: | 27 public: |
| 28 InteractiveUITestSuite(int argc, char** argv) : ChromeTestSuite(argc, argv) {} | 28 InteractiveUITestSuite(int argc, char** argv) : ChromeTestSuite(argc, argv) {} |
| 29 virtual ~InteractiveUITestSuite() {} | 29 ~InteractiveUITestSuite() override {} |
| 30 | 30 |
| 31 protected: | 31 protected: |
| 32 // ChromeTestSuite overrides: | 32 // ChromeTestSuite overrides: |
| 33 virtual void Initialize() override { | 33 void Initialize() override { |
| 34 ChromeTestSuite::Initialize(); | 34 ChromeTestSuite::Initialize(); |
| 35 | 35 |
| 36 // Only allow ui_controls to be used in interactive_ui_tests, since they | 36 // Only allow ui_controls to be used in interactive_ui_tests, since they |
| 37 // depend on focus and can't be sharded. | 37 // depend on focus and can't be sharded. |
| 38 ui_controls::EnableUIControls(); | 38 ui_controls::EnableUIControls(); |
| 39 | 39 |
| 40 #if defined(OS_CHROMEOS) | 40 #if defined(OS_CHROMEOS) |
| 41 ui_controls::InstallUIControlsAura(ash::test::CreateAshUIControls()); | 41 ui_controls::InstallUIControlsAura(ash::test::CreateAshUIControls()); |
| 42 #elif defined(USE_AURA) | 42 #elif defined(USE_AURA) |
| 43 #if defined(OS_WIN) | 43 #if defined(OS_WIN) |
| 44 com_initializer_.reset(new base::win::ScopedCOMInitializer()); | 44 com_initializer_.reset(new base::win::ScopedCOMInitializer()); |
| 45 #endif | 45 #endif |
| 46 | 46 |
| 47 #if defined(OS_LINUX) | 47 #if defined(OS_LINUX) |
| 48 ui_controls::InstallUIControlsAura( | 48 ui_controls::InstallUIControlsAura( |
| 49 views::test::CreateUIControlsDesktopAura()); | 49 views::test::CreateUIControlsDesktopAura()); |
| 50 #else | 50 #else |
| 51 // TODO(win_ash): when running interactive_ui_tests for Win Ash, use above. | 51 // TODO(win_ash): when running interactive_ui_tests for Win Ash, use above. |
| 52 ui_controls::InstallUIControlsAura(aura::test::CreateUIControlsAura(NULL)); | 52 ui_controls::InstallUIControlsAura(aura::test::CreateUIControlsAura(NULL)); |
| 53 #endif | 53 #endif |
| 54 #endif | 54 #endif |
| 55 } | 55 } |
| 56 | 56 |
| 57 virtual void Shutdown() override { | 57 void Shutdown() override { |
| 58 #if defined(OS_WIN) | 58 #if defined(OS_WIN) |
| 59 com_initializer_.reset(); | 59 com_initializer_.reset(); |
| 60 #endif | 60 #endif |
| 61 } | 61 } |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 #if defined(OS_WIN) | 64 #if defined(OS_WIN) |
| 65 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; | 65 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; |
| 66 #endif | 66 #endif |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 class InteractiveUITestSuiteRunner : public ChromeTestSuiteRunner { | 69 class InteractiveUITestSuiteRunner : public ChromeTestSuiteRunner { |
| 70 public: | 70 public: |
| 71 virtual int RunTestSuite(int argc, char** argv) override { | 71 int RunTestSuite(int argc, char** argv) override { |
| 72 return InteractiveUITestSuite(argc, argv).Run(); | 72 return InteractiveUITestSuite(argc, argv).Run(); |
| 73 } | 73 } |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 int main(int argc, char** argv) { | 76 int main(int argc, char** argv) { |
| 77 // Run interactive_ui_tests serially, they do not support running in parallel. | 77 // Run interactive_ui_tests serially, they do not support running in parallel. |
| 78 int default_jobs = 1; | 78 int default_jobs = 1; |
| 79 InteractiveUITestSuiteRunner runner; | 79 InteractiveUITestSuiteRunner runner; |
| 80 return LaunchChromeTests(default_jobs, &runner, argc, argv); | 80 return LaunchChromeTests(default_jobs, &runner, argc, argv); |
| 81 } | 81 } |
| OLD | NEW |