Durable Storage: Refactor browser test and test the basic "deny" flow.
[chromium-blink-merge.git] / chrome / test / base / interactive_ui_tests_main.cc
blob59e56ff2d8c6151d86010b0de70cad5256c913f6
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
3 // found in the LICENSE file.
5 #include "chrome/test/base/chrome_test_launcher.h"
7 #include "chrome/test/base/chrome_test_suite.h"
8 #include "ui/base/test/ui_controls.h"
10 #if defined(USE_AURA)
11 #include "ui/aura/test/ui_controls_factory_aura.h"
12 #include "ui/base/test/ui_controls_aura.h"
13 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
14 #include "ui/views/test/ui_controls_factory_desktop_aurax11.h"
15 #endif
16 #endif
18 #if defined(OS_CHROMEOS)
19 #include "ash/test/ui_controls_factory_ash.h"
20 #endif
22 #if defined(OS_WIN)
23 #include "base/win/scoped_com_initializer.h"
24 #endif
26 class InteractiveUITestSuite : public ChromeTestSuite {
27 public:
28 InteractiveUITestSuite(int argc, char** argv) : ChromeTestSuite(argc, argv) {}
29 ~InteractiveUITestSuite() override {}
31 protected:
32 // ChromeTestSuite overrides:
33 void Initialize() override {
34 ChromeTestSuite::Initialize();
36 // Only allow ui_controls to be used in interactive_ui_tests, since they
37 // depend on focus and can't be sharded.
38 ui_controls::EnableUIControls();
40 #if defined(OS_CHROMEOS)
41 ui_controls::InstallUIControlsAura(ash::test::CreateAshUIControls());
42 #elif defined(USE_AURA)
43 #if defined(OS_WIN)
44 com_initializer_.reset(new base::win::ScopedCOMInitializer());
45 #endif
47 #if defined(OS_LINUX)
48 ui_controls::InstallUIControlsAura(
49 views::test::CreateUIControlsDesktopAura());
50 #else
51 // TODO(win_ash): when running interactive_ui_tests for Win Ash, use above.
52 ui_controls::InstallUIControlsAura(aura::test::CreateUIControlsAura(NULL));
53 #endif
54 #endif
57 void Shutdown() override {
58 #if defined(OS_WIN)
59 com_initializer_.reset();
60 #endif
63 private:
64 #if defined(OS_WIN)
65 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_;
66 #endif
69 class InteractiveUITestSuiteRunner : public ChromeTestSuiteRunner {
70 public:
71 int RunTestSuite(int argc, char** argv) override {
72 return InteractiveUITestSuite(argc, argv).Run();
76 int main(int argc, char** argv) {
77 // Run interactive_ui_tests serially, they do not support running in parallel.
78 int default_jobs = 1;
79 InteractiveUITestSuiteRunner runner;
80 return LaunchChromeTests(default_jobs, &runner, argc, argv);