summaryrefslogtreecommitdiffstats
path: root/views/test
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-10 01:50:41 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-10 01:50:41 +0000
commit99c49f669269d90bdfe4610fa7179d140edd55d9 (patch)
tree6b4ff57e0840671fc779b48ffbb35709cd016cd5 /views/test
parentaa351637499a15c75ade4e29d92d861be2bad5eb (diff)
downloadchromium_src-99c49f669269d90bdfe4610fa7179d140edd55d9.zip
chromium_src-99c49f669269d90bdfe4610fa7179d140edd55d9.tar.gz
chromium_src-99c49f669269d90bdfe4610fa7179d140edd55d9.tar.bz2
Fix final nits on linux_views
BUG=carnitas TEST=compiles Review URL: http://codereview.chromium.org/6612047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77584 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/test')
-rw-r--r--views/test/test_views_delegate.cc29
-rw-r--r--views/test/test_views_delegate.h26
-rw-r--r--views/test/views_test_base.cc31
-rw-r--r--views/test/views_test_base.h24
4 files changed, 74 insertions, 36 deletions
diff --git a/views/test/test_views_delegate.cc b/views/test/test_views_delegate.cc
new file mode 100644
index 0000000..a9f9b58
--- /dev/null
+++ b/views/test/test_views_delegate.cc
@@ -0,0 +1,29 @@
+// 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.
+
+#include "views/test/test_views_delegate.h"
+
+TestViewsDelegate::TestViewsDelegate() {}
+TestViewsDelegate::~TestViewsDelegate() {}
+
+ui::Clipboard* TestViewsDelegate::GetClipboard() const {
+ if (!clipboard_.get()) {
+ // Note that we need a MessageLoop for the next call to work.
+ clipboard_.reset(new ui::Clipboard);
+ }
+ return clipboard_.get();
+}
+
+
+bool TestViewsDelegate::GetSavedWindowBounds(views::Window* window,
+ const std::wstring& window_name,
+ gfx::Rect* bounds) const {
+ return false;
+}
+
+bool TestViewsDelegate::GetSavedMaximizedState(views::Window* window,
+ const std::wstring& window_name,
+ bool* maximized) const {
+ return false;
+}
diff --git a/views/test/test_views_delegate.h b/views/test/test_views_delegate.h
index 2ac03ae..9aaee21 100644
--- a/views/test/test_views_delegate.h
+++ b/views/test/test_views_delegate.h
@@ -1,7 +1,10 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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_TEST_VIEWS_DELEGATE_H_
+#define VIEWS_TEST_TEST_VIEWS_DELEGATE_H_
+
#include "base/scoped_ptr.h"
#include "ui/base/clipboard/clipboard.h"
#include "views/views_delegate.h"
@@ -12,17 +15,11 @@ class Window;
class TestViewsDelegate : public views::ViewsDelegate {
public:
- TestViewsDelegate() {}
- virtual ~TestViewsDelegate() {}
+ TestViewsDelegate();
+ virtual ~TestViewsDelegate();
// Overridden from views::ViewsDelegate:
- virtual ui::Clipboard* GetClipboard() const {
- if (!clipboard_.get()) {
- // Note that we need a MessageLoop for the next call to work.
- clipboard_.reset(new ui::Clipboard);
- }
- return clipboard_.get();
- }
+ virtual ui::Clipboard* GetClipboard() const;
virtual void SaveWindowPlacement(views::Window* window,
const std::wstring& window_name,
const gfx::Rect& bounds,
@@ -30,14 +27,10 @@ class TestViewsDelegate : public views::ViewsDelegate {
}
virtual bool GetSavedWindowBounds(views::Window* window,
const std::wstring& window_name,
- gfx::Rect* bounds) const {
- return false;
- }
+ gfx::Rect* bounds) const;
virtual bool GetSavedMaximizedState(views::Window* window,
const std::wstring& window_name,
- bool* maximized) const {
- return false;
- }
+ bool* maximized) const;
virtual void NotifyAccessibilityEvent(
views::View* view, AccessibilityTypes::Event event_type) {}
virtual void NotifyMenuItemFocused(
@@ -60,3 +53,4 @@ class TestViewsDelegate : public views::ViewsDelegate {
DISALLOW_COPY_AND_ASSIGN(TestViewsDelegate);
};
+#endif // VIEWS_TEST_TEST_VIEWS_DELEGATE_H_
diff --git a/views/test/views_test_base.cc b/views/test/views_test_base.cc
new file mode 100644
index 0000000..c78bf27
--- /dev/null
+++ b/views/test/views_test_base.cc
@@ -0,0 +1,31 @@
+// 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.
+
+#include "views/test/views_test_base.h"
+
+#if defined(OS_WIN)
+#include <ole2.h>
+#endif
+
+namespace views {
+
+ViewsTestBase::ViewsTestBase() {
+#if defined(OS_WIN)
+ OleInitialize(NULL);
+#endif
+}
+
+ViewsTestBase::~ViewsTestBase() {
+#if defined(OS_WIN)
+ OleUninitialize();
+#endif
+}
+
+void ViewsTestBase::TearDown() {
+ // Flush the message loop because we have pending release tasks
+ // and these tasks if un-executed would upset Valgrind.
+ RunPendingMessages();
+}
+
+} // namespace views
diff --git a/views/test/views_test_base.h b/views/test/views_test_base.h
index d66a1d8..7c45c2e 100644
--- a/views/test/views_test_base.h
+++ b/views/test/views_test_base.h
@@ -10,33 +10,17 @@
#include "base/message_loop.h"
-#if defined(OS_WIN)
-#include <ole2.h>
-#endif
-
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
- }
+ ViewsTestBase();
+ virtual ~ViewsTestBase();
- 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();
- }
+ // testing::Test:
+ virtual void TearDown();
void RunPendingMessages() {
message_loop_.RunAllPending();