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

Unified Diff: ui/views/focus/focus_manager_test.h

Issue 8642002: Enable FocusManager tests for Aura. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 | « ui/views/focus/focus_manager.cc ('k') | ui/views/focus/focus_manager_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/focus/focus_manager_test.h
===================================================================
--- ui/views/focus/focus_manager_test.h (revision 0)
+++ ui/views/focus/focus_manager_test.h (revision 0)
@@ -0,0 +1,75 @@
+// 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 UI_VIEWS_FOCUS_FOCUS_MANAGER_TEST_H_
+#define UI_VIEWS_FOCUS_FOCUS_MANAGER_TEST_H_
+
+#include "ui/views/focus/focus_manager.h"
+#include "ui/views/test/views_test_base.h"
+#include "ui/views/widget/widget_delegate.h"
+
+namespace views {
+
+class FocusChangeListener;
+
+class FocusManagerTest : public ViewsTestBase,
+ public WidgetDelegate {
+ public:
+ FocusManagerTest();
+ virtual ~FocusManagerTest();
+
+ // Convenience to obtain the focus manager for the test's hosting widget.
+ FocusManager* GetFocusManager();
+
+ // Overridden from ViewsTestBase:
+ virtual void SetUp() OVERRIDE;
+ virtual void TearDown() OVERRIDE;
+
+ // Overridden from WidgetDelegate:
+ virtual View* GetContentsView() OVERRIDE;
+ virtual Widget* GetWidget() OVERRIDE;
+ virtual const Widget* GetWidget() const OVERRIDE;
+
+ protected:
+ virtual void InitContentView();
sky 2011/11/22 21:12:38 Add a description.
+
+ void AddFocusChangeListener(FocusChangeListener* listener);
+
+#if defined(OS_WIN) && !defined(USE_AURA)
+ // Mocks activating/deactivating the window.
+ void SimulateActivateWindow();
+ void SimulateDeactivateWindow();
+
+ void PostKeyDown(ui::KeyboardCode key_code);
+ void PostKeyUp(ui::KeyboardCode key_code);
+#endif
+
+ private:
+ View* contents_view_;
+ FocusChangeListener* focus_change_listener_;
+
+ DISALLOW_COPY_AND_ASSIGN(FocusManagerTest);
+};
+
+typedef std::pair<View*, View*> ViewPair;
+
+class TestFocusChangeListener : public FocusChangeListener {
sky 2011/11/22 21:12:38 Add a description.
+ public:
+ const std::vector<ViewPair>& focus_changes() const { return focus_changes_; }
+ void ClearFocusChanges();
+
+ // Overridden from FocusChangeListener:
+ virtual void OnWillChangeFocus(View* focused_before,
+ View* focused_now) OVERRIDE;
+ virtual void OnDidChangeFocus(View* focused_before,
+ View* focused_now) OVERRIDE;
+
+ private:
+ // A vector of which views lost/gained focus.
+ std::vector<ViewPair> focus_changes_;
+};
sky 2011/11/22 21:12:38 DISALLOW_COPY_AND_ASSIGN
+
+} // namespace views
+
+#endif // UI_VIEWS_FOCUS_FOCUS_MANAGER_TEST_H_
Property changes on: ui\views\focus\focus_manager_test.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « ui/views/focus/focus_manager.cc ('k') | ui/views/focus/focus_manager_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698