diff options
author | nona@chromium.org <nona@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-31 11:48:20 +0000 |
---|---|---|
committer | nona@chromium.org <nona@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-31 11:48:20 +0000 |
commit | e6c896f16eefb080ad483b144516a2919a4292bc (patch) | |
tree | bc037c1f769797e869c9ff8bb07798c1a308f100 | |
parent | d3a652c574b9c1669d8f4ff0680d2ac15e153372 (diff) | |
download | chromium_src-e6c896f16eefb080ad483b144516a2919a4292bc.zip chromium_src-e6c896f16eefb080ad483b144516a2919a4292bc.tar.gz chromium_src-e6c896f16eefb080ad483b144516a2919a4292bc.tar.bz2 |
Introduce TextInputTestSupport.
This CL is preparation for http://codereview.chromium.org/10388220.
This CL does not affect current test contents or browser behaviors.
This CL contains follows:
1. Add chromeos and dbus include rule into ui/DEPS
To replace text inputting module from libibus to chrome dbus library,
ui/base/ime/* should depend to chromeos/dbus/* and dbus/*
2. Introduce TextInputSupport for input testing.
To use chorme library, should initialize DBusThreadManager before using
DBusThreadManager instance.
3. Calls TextInputSupport::Initialize/Shutdown for some test.
Some test uses text inputting module implicitly. So should call Initialize/Shutdown on SetUp/TearDown.
BUG=126947
TEST=browser_tests,interactive_ui_tests,ui_unittests,aura_unittests,aura_shell_unittests,unit_tests,chromeos_unittests,dbus_unittets
Review URL: https://chromiumcodereview.appspot.com/10447022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139775 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/ash.gyp | 1 | ||||
-rw-r--r-- | ash/test/ash_test_base.cc | 3 | ||||
-rw-r--r-- | chrome/test/base/view_event_test_base.cc | 3 | ||||
-rw-r--r-- | ui/DEPS | 1 | ||||
-rw-r--r-- | ui/aura/aura.gyp | 1 | ||||
-rw-r--r-- | ui/aura/test/aura_test_base.cc | 3 | ||||
-rw-r--r-- | ui/base/ime/ime_test_support.gypi | 10 | ||||
-rw-r--r-- | ui/base/ime/text_input_test_support.cc | 29 | ||||
-rw-r--r-- | ui/base/ime/text_input_test_support.h | 29 | ||||
-rw-r--r-- | ui/ui_unittests.gypi | 11 |
10 files changed, 91 insertions, 0 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp index 50ef085..c02061c 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -345,6 +345,7 @@ '../ui/ui.gyp:ui', '../ui/ui.gyp:ui_resources', '../ui/ui.gyp:ui_resources_standard', + '../ui/ui.gyp:ui_test_support', '../ui/views/views.gyp:views', '../ui/views/views.gyp:test_support_views', 'ash', diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc index 0e6b72b..e67754b 100644 --- a/ash/test/ash_test_base.cc +++ b/ash/test/ash_test_base.cc @@ -12,6 +12,7 @@ #include "ui/aura/env.h" #include "ui/aura/monitor_manager.h" #include "ui/aura/root_window.h" +#include "ui/base/ime/text_input_test_support.h" #include "ui/compositor/layer_animator.h" #include "ui/gfx/monitor.h" #include "ui/gfx/screen.h" @@ -33,6 +34,7 @@ AshTestBase::~AshTestBase() { } void AshTestBase::SetUp() { + ui::TextInputTestSupport::Initilaize(); // Creates Shell and hook with Desktop. TestShellDelegate* delegate = new TestShellDelegate; ash::Shell::CreateInstance(delegate); @@ -50,6 +52,7 @@ void AshTestBase::TearDown() { // Tear down the shell. Shell::DeleteInstance(); aura::Env::DeleteInstance(); + ui::TextInputTestSupport::Shutdown(); } void AshTestBase::ChangeMonitorConfig(float scale, diff --git a/chrome/test/base/view_event_test_base.cc b/chrome/test/base/view_event_test_base.cc index 9c14d7c..117fd0e 100644 --- a/chrome/test/base/view_event_test_base.cc +++ b/chrome/test/base/view_event_test_base.cc @@ -10,6 +10,7 @@ #include "base/string_number_conversions.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/browser_thread.h" +#include "ui/base/ime/text_input_test_support.h" #include "ui/compositor/test/compositor_test_support.h" #include "ui/ui_controls/ui_controls.h" #include "ui/views/view.h" @@ -82,6 +83,7 @@ void ViewEventTestBase::Done() { } void ViewEventTestBase::SetUp() { + ui::TextInputTestSupport::Initilaize(); ui::CompositorTestSupport::Initialize(); #if defined(USE_ASH) ash::Shell::CreateInstance(NULL); @@ -110,6 +112,7 @@ void ViewEventTestBase::TearDown() { aura::Env::DeleteInstance(); #endif ui::CompositorTestSupport::Terminate(); + ui::TextInputTestSupport::Shutdown(); } bool ViewEventTestBase::CanResize() const { @@ -1,4 +1,5 @@ include_rules = [ + "+chromeos/dbus", "+grit/app_locale_settings.h", "+grit/native_theme_resources.h", "+grit/ui_resources_standard.h", diff --git a/ui/aura/aura.gyp b/ui/aura/aura.gyp index 3762b0d..327067b 100644 --- a/ui/aura/aura.gyp +++ b/ui/aura/aura.gyp @@ -262,6 +262,7 @@ '../ui.gyp:ui', '../ui.gyp:ui_resources', '../ui.gyp:ui_resources_standard', + '../ui.gyp:ui_test_support', 'test_support_aura', 'aura', ], diff --git a/ui/aura/test/aura_test_base.cc b/ui/aura/test/aura_test_base.cc index e1fe5b8..b128cab 100644 --- a/ui/aura/test/aura_test_base.cc +++ b/ui/aura/test/aura_test_base.cc @@ -6,6 +6,7 @@ #include "ui/aura/test/aura_test_helper.h" #include "ui/base/gestures/gesture_configuration.h" +#include "ui/base/ime/text_input_test_support.h" namespace aura { namespace test { @@ -18,6 +19,7 @@ AuraTestBase::~AuraTestBase() { void AuraTestBase::SetUp() { testing::Test::SetUp(); + ui::TextInputTestSupport::Initilaize(); // Changing the parameters for gesture recognition shouldn't cause // tests to fail, so we use a separate set of parameters for unit @@ -49,6 +51,7 @@ void AuraTestBase::TearDown() { RunAllPendingInMessageLoop(); helper_->TearDown(); + ui::TextInputTestSupport::Shutdown(); testing::Test::TearDown(); } diff --git a/ui/base/ime/ime_test_support.gypi b/ui/base/ime/ime_test_support.gypi new file mode 100644 index 0000000..c9e6194 --- /dev/null +++ b/ui/base/ime/ime_test_support.gypi @@ -0,0 +1,10 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'sources': [ + 'text_input_test_support.cc', + 'text_input_test_support.h', + ], +} diff --git a/ui/base/ime/text_input_test_support.cc b/ui/base/ime/text_input_test_support.cc new file mode 100644 index 0000000..6e7df1c --- /dev/null +++ b/ui/base/ime/text_input_test_support.cc @@ -0,0 +1,29 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/base/ime/text_input_test_support.h" + +#include "chromeos/dbus/dbus_thread_manager.h" + +namespace ui { + +TextInputTestSupport::TextInputTestSupport() { +} + +TextInputTestSupport::~TextInputTestSupport() { +} + +void TextInputTestSupport::Initilaize() { +#if defined(OS_CHROMEOS) + chromeos::DBusThreadManager::InitializeWithStub(); +#endif // OS_CHROMEOS +} + +void TextInputTestSupport::Shutdown() { +#if defined(OS_CHROMEOS) + chromeos::DBusThreadManager::Shutdown(); +#endif // OS_CHROMEOS +} + +} // namespace ui diff --git a/ui/base/ime/text_input_test_support.h b/ui/base/ime/text_input_test_support.h new file mode 100644 index 0000000..8e589a562 --- /dev/null +++ b/ui/base/ime/text_input_test_support.h @@ -0,0 +1,29 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_BASE_IME_TEXT_INPUT_TEST_SUPPORT_H_ +#define UI_BASE_IME_TEXT_INPUT_TEST_SUPPORT_H_ + +#include "base/basictypes.h" + +namespace ui { + +class TextInputTestSupport { + public: + TextInputTestSupport(); + virtual ~TextInputTestSupport(); + + // Initialize DBusThreadManager for text input testing. + static void Initilaize(); + + // Shutdown DBusThreadManager. + static void Shutdown(); + + private: + DISALLOW_COPY_AND_ASSIGN(TextInputTestSupport); +}; + +} // namespace ui + +#endif // UI_BASE_IME_TEXT_INPUT_TEST_SUPPORT_H_ diff --git a/ui/ui_unittests.gypi b/ui/ui_unittests.gypi index 28fa51a..f05215c 100644 --- a/ui/ui_unittests.gypi +++ b/ui/ui_unittests.gypi @@ -7,6 +7,9 @@ { 'target_name': 'ui_test_support', 'type': 'static_library', + 'includes': [ + 'base/ime/ime_test_support.gypi', + ], 'dependencies': [ '../base/base.gyp:base', '../testing/gtest.gyp:gtest', @@ -22,6 +25,14 @@ 'include_dirs': [ '../', ], + 'conditions': [ + ['chromeos==1', { + 'dependencies': [ + '../chromeos/chromeos.gyp:chromeos_test_support', + '../skia/skia.gyp:skia', + ] + }], + ], }, { 'target_name': 'ui_unittests', |