Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Unified Diff: views/focus/focus_manager_unittest.cc

Issue 7720020: Get views_unittests pass on touch build (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: enable TouchSelectionControllerImplTest as they're fixed Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/controls/textfield/native_textfield_views_unittest.cc ('k') | views/test/views_test_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/focus/focus_manager_unittest.cc
diff --git a/views/focus/focus_manager_unittest.cc b/views/focus/focus_manager_unittest.cc
index f31893b941236728f193e497c356e3b56f9880bd..aefd982fb4684b011f74e3040cb77b5dd00dfb04 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()));
« no previous file with comments | « views/controls/textfield/native_textfield_views_unittest.cc ('k') | views/test/views_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698