diff options
author | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-24 22:08:29 +0000 |
---|---|---|
committer | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-24 22:08:29 +0000 |
commit | f641e73f63c4ee84ae7c412c7c225eb493539ce8 (patch) | |
tree | 8a61fd6ba2ef95867e88cf102e538553e8d756bc /views/focus | |
parent | 578c696d2d820567eb0cd938476fedee4a892f56 (diff) | |
download | chromium_src-f641e73f63c4ee84ae7c412c7c225eb493539ce8.zip chromium_src-f641e73f63c4ee84ae7c412c7c225eb493539ce8.tar.gz chromium_src-f641e73f63c4ee84ae7c412c7c225eb493539ce8.tar.bz2 |
Get views_unittests pass on touch build
* Changed views test to use ViewsTestBase.
* Always calls ViewsTestBase::SetUp/TearDown. Added flags to check if this is enforced.
* Excluded tests that does not make sense on touch/pure views build.
BUG=none
TEST=views_unittets now passes on touch build, with a few exceptions below.
WidgetTest.GrabUngrab: assigned to sadrul
NativeTextfieldViewsTest.DragAndDrop_XXX: msw will look into it.
Review URL: http://codereview.chromium.org/7720020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98128 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/focus')
-rw-r--r-- | views/focus/focus_manager_unittest.cc | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/views/focus/focus_manager_unittest.cc b/views/focus/focus_manager_unittest.cc index f31893b..aefd982 100644 --- a/views/focus/focus_manager_unittest.cc +++ b/views/focus/focus_manager_unittest.cc @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "testing/gtest/include/gtest/gtest.h" - #include "base/logging.h" #include "base/string16.h" #include "base/string_number_conversions.h" @@ -27,6 +25,7 @@ #include "views/controls/textfield/textfield.h" #include "views/focus/accelerator_handler.h" #include "views/focus/focus_manager_factory.h" +#include "views/test/views_test_base.h" #include "views/widget/root_view.h" #include "views/widget/widget.h" #include "views/widget/widget_delegate.h" @@ -100,24 +99,19 @@ const int kThumbnailSuperStarID = count++; namespace views { -class FocusManagerTest : public testing::Test, public WidgetDelegate { +class FocusManagerTest : public ViewsTestBase, public WidgetDelegate { public: FocusManagerTest() : window_(NULL), content_view_(NULL), focus_change_listener_(NULL) { -#if defined(OS_WIN) - OleInitialize(NULL); -#endif } ~FocusManagerTest() { -#if defined(OS_WIN) - OleUninitialize(); -#endif } virtual void SetUp() OVERRIDE { + ViewsTestBase::SetUp(); window_ = Widget::CreateWindowWithBounds(this, bounds()); InitContentView(); window_->Show(); @@ -129,7 +123,8 @@ class FocusManagerTest : public testing::Test, public WidgetDelegate { window_->Close(); // Flush the message loop to make application verifiers happy. - message_loop()->RunAllPending(); + RunPendingMessages(); + ViewsTestBase::TearDown(); } FocusManager* GetFocusManager() { @@ -193,8 +188,6 @@ class FocusManagerTest : public testing::Test, public WidgetDelegate { #endif } - MessageLoopForUI* message_loop() { return &message_loop_; } - Widget* window_; View* content_view_; @@ -256,7 +249,6 @@ class FocusManagerTest : public testing::Test, public WidgetDelegate { private: FocusChangeListener* focus_change_listener_; - MessageLoopForUI message_loop_; DISALLOW_COPY_AND_ASSIGN(FocusManagerTest); }; @@ -963,13 +955,13 @@ TEST_F(FocusManagerTest, FocusStoreRestore) { content_view_->AddChildView(button); button->SetBounds(10, 10, 200, 30); content_view_->AddChildView(view); - message_loop()->RunAllPending(); + RunPendingMessages(); TestFocusChangeListener listener; AddFocusChangeListener(&listener); view->RequestFocus(); - message_loop()->RunAllPending(); + RunPendingMessages(); // MessageLoopForUI::current()->Run(new AcceleratorHandler()); // Visual Studio 2010 has problems converting NULL to the null pointer for @@ -1699,6 +1691,7 @@ class FocusManagerDtorTest : public FocusManagerTest { }; virtual void SetUp() { + ViewsTestBase::SetUp(); FocusManagerFactory::Install(new TestFocusManagerFactory(&dtor_tracker_)); // Create WindowDtorTracked that uses FocusManagerDtorTracked. window_ = new WindowDtorTracked(&dtor_tracker_); @@ -1715,9 +1708,10 @@ class FocusManagerDtorTest : public FocusManagerTest { virtual void TearDown() { if (window_) { window_->Close(); - message_loop()->RunAllPending(); + RunPendingMessages(); } FocusManagerFactory::Install(NULL); + ViewsTestBase::TearDown(); } FocusManager* tracked_focus_manager_; @@ -1735,7 +1729,7 @@ TEST_F(FocusManagerDtorTest, FocusManagerDestructedLast) { // Close the window. window_->Close(); - message_loop()->RunAllPending(); + RunPendingMessages(); // Test window, button and focus manager should all be destructed. ASSERT_EQ(3, static_cast<int>(dtor_tracker_.size())); |