diff options
author | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-12 17:10:09 +0000 |
---|---|---|
committer | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-12 17:10:09 +0000 |
commit | 0b8a1756fd97f6df198482cf2e45f4ba814bcb51 (patch) | |
tree | ec809b7680600a8612a555431a73ff533a9e4173 /views/test | |
parent | 879197377ddc7b595b2560e26466fbb5bb96f6dd (diff) | |
download | chromium_src-0b8a1756fd97f6df198482cf2e45f4ba814bcb51.zip chromium_src-0b8a1756fd97f6df198482cf2e45f4ba814bcb51.tar.gz chromium_src-0b8a1756fd97f6df198482cf2e45f4ba814bcb51.tar.bz2 |
Compile and test TextfieldViews on win as well.
Created common test base class for views.
Note: Textfield::RequestFocus is failing because Windows' FocusManager::ClearNativeFocus resets the focused view to NULL for some reason. I don't have win at hand and am now requesting win7. I will look into it once I've got win7.
BUG=none
TEST=native_textfield_views_unittest and textfield_views_model_unittest have been enabled for win.
Review URL: http://codereview.chromium.org/6102003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71183 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/test')
-rw-r--r-- | views/test/views_test_base.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/views/test/views_test_base.h b/views/test/views_test_base.h new file mode 100644 index 0000000..080eca5 --- /dev/null +++ b/views/test/views_test_base.h @@ -0,0 +1,49 @@ +// Copyright (c) 2011 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 VIEWS_TEST_VIEWS_TEST_BASE_H_ +#define VIEWS_TEST_VIEWS_TEST_BASE_H_ +#pragma once + +#include "testing/gtest/include/gtest/gtest.h" + +#include "base/message_loop.h" + +namespace views { + +// A base class for views unit test. It creates a message loop necessary +// to drive UI events and takes care of OLE initialization for windows. +class ViewsTestBase : public testing::Test { + public: + ViewsTestBase() { +#if defined(OS_WIN) + OleInitialize(NULL); +#endif + } + + virtual ~ViewsTestBase() { +#if defined(OS_WIN) + OleUninitialize(); +#endif + } + + virtual void TearDown() { + // Flush the message loop because we have pending release tasks + // and these tasks if un-executed would upset Valgrind. + RunPendingMessages(); + } + + void RunPendingMessages() { + message_loop_.RunAllPending(); + } + + private: + MessageLoopForUI message_loop_; + + DISALLOW_COPY_AND_ASSIGN(ViewsTestBase); +}; + +} // namespace views + +#endif // VIEWS_TEST_VIEWS_TEST_BASE_H_ |