Fixes content_browsertests with --enable-text-input-focus-manager flag enabled.

Some tests in content_browsertests are broken if --enable-text-input-focus-manager is enabled.  Fix those tests.

Since not all unittests run wm::FocusController::SetFocusedWindow, it turned out that we need WMTestHelper (instead of FocusController) to clear the text input client.

BUG=290701
TEST=Run content_browsertests with --enable-text-input-focus-manager enabled.

Review URL: https://codereview.chromium.org/340413002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278793 0039d316-1c4b-4281-b951-d872f2087c98
parent e710476c
...@@ -70,6 +70,4 @@ IN_PROC_BROWSER_TEST_F(BookmarkletTest, DocumentWrite) { ...@@ -70,6 +70,4 @@ IN_PROC_BROWSER_TEST_F(BookmarkletTest, DocumentWrite) {
EXPECT_EQ("hello world", GetBodyText()); EXPECT_EQ("hello world", GetBodyText());
} }
} // namespace content } // namespace content
...@@ -104,7 +104,7 @@ void ContentBrowserTest::TearDown() { ...@@ -104,7 +104,7 @@ void ContentBrowserTest::TearDown() {
BrowserTestBase::TearDown(); BrowserTestBase::TearDown();
// LinuxInputMethodContextFactory has to be shutdown. // LinuxInputMethodContextFactory has to be shutdown.
#if !defined(OS_CHROMEOS) && defined(USE_AURA) && defined(USE_X11) #if !defined(OS_CHROMEOS) && defined(OS_LINUX)
ui::ShutdownInputMethodForTesting(); ui::ShutdownInputMethodForTesting();
#endif #endif
......
...@@ -437,6 +437,7 @@ void Shell::PlatformInitialize(const gfx::Size& default_window_size) { ...@@ -437,6 +437,7 @@ void Shell::PlatformInitialize(const gfx::Size& default_window_size) {
void Shell::PlatformExit() { void Shell::PlatformExit() {
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
delete wm_test_helper_; delete wm_test_helper_;
wm_test_helper_ = NULL;
#endif #endif
delete views_delegate_; delete views_delegate_;
views_delegate_ = NULL; views_delegate_ = NULL;
......
include_rules = [ include_rules = [
"+ui/aura", "+ui/aura",
"+ui/base/ime/text_input_focus_manager.h",
"+ui/base/resource/resource_bundle.h", "+ui/base/resource/resource_bundle.h",
"+ui/base/ui_base_paths.h", "+ui/base/ui_base_paths.h",
"+ui/gl", "+ui/gl",
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "ui/aura/env.h" #include "ui/aura/env.h"
#include "ui/aura/test/test_focus_client.h" #include "ui/aura/test/test_focus_client.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/base/ime/text_input_focus_manager.h"
#include "ui/wm/core/compound_event_filter.h" #include "ui/wm/core/compound_event_filter.h"
#include "ui/wm/core/default_activation_client.h" #include "ui/wm/core/default_activation_client.h"
#include "ui/wm/core/input_method_event_filter.h" #include "ui/wm/core/input_method_event_filter.h"
...@@ -16,6 +17,7 @@ namespace wm { ...@@ -16,6 +17,7 @@ namespace wm {
WMTestHelper::WMTestHelper(const gfx::Size& default_window_size, WMTestHelper::WMTestHelper(const gfx::Size& default_window_size,
ui::ContextFactory* context_factory) { ui::ContextFactory* context_factory) {
ui::TextInputFocusManager::GetInstance()->FocusTextInputClient(NULL);
aura::Env::CreateInstance(true); aura::Env::CreateInstance(true);
aura::Env::GetInstance()->set_context_factory(context_factory); aura::Env::GetInstance()->set_context_factory(context_factory);
host_.reset(aura::WindowTreeHost::Create(gfx::Rect(default_window_size))); host_.reset(aura::WindowTreeHost::Create(gfx::Rect(default_window_size)));
...@@ -41,6 +43,7 @@ WMTestHelper::WMTestHelper(const gfx::Size& default_window_size, ...@@ -41,6 +43,7 @@ WMTestHelper::WMTestHelper(const gfx::Size& default_window_size,
WMTestHelper::~WMTestHelper() { WMTestHelper::~WMTestHelper() {
root_window_event_filter_->RemoveHandler(input_method_filter_.get()); root_window_event_filter_->RemoveHandler(input_method_filter_.get());
ui::TextInputFocusManager::GetInstance()->FocusTextInputClient(NULL);
} }
aura::Window* WMTestHelper::GetDefaultParent(aura::Window* context, aura::Window* WMTestHelper::GetDefaultParent(aura::Window* context,
......
...@@ -98,6 +98,7 @@ ...@@ -98,6 +98,7 @@
'dependencies': [ 'dependencies': [
'../../skia/skia.gyp:skia', '../../skia/skia.gyp:skia',
'../aura/aura.gyp:aura', '../aura/aura.gyp:aura',
'../base/ui_base.gyp:ui_base',
'../events/events.gyp:events', '../events/events.gyp:events',
'../events/events.gyp:events_base', '../events/events.gyp:events_base',
], ],
...@@ -116,12 +117,12 @@ ...@@ -116,12 +117,12 @@
'../../testing/gtest.gyp:gtest', '../../testing/gtest.gyp:gtest',
'../aura/aura.gyp:aura', '../aura/aura.gyp:aura',
'../aura/aura.gyp:aura_test_support', '../aura/aura.gyp:aura_test_support',
'../base/ui_base.gyp:ui_base',
'../compositor/compositor.gyp:compositor', '../compositor/compositor.gyp:compositor',
'../events/events.gyp:events', '../events/events.gyp:events',
'../events/events.gyp:events_base', '../events/events.gyp:events_base',
'../gfx/gfx.gyp:gfx_geometry',
'../gfx/gfx.gyp:gfx', '../gfx/gfx.gyp:gfx',
'../base/ui_base.gyp:ui_base', '../gfx/gfx.gyp:gfx_geometry',
'wm', 'wm',
'wm_test_support', 'wm_test_support',
], ],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment