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

Side by Side Diff: ui/views/test/scoped_views_test_helper.h

Issue 2604303002: (Mac)Views: Widgets focus first View in traversal order if initial focus fails. (Closed)
Patch Set: Fix compile error. Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_VIEWS_TEST_SCOPED_VIEWS_TEST_HELPER_H_ 5 #ifndef UI_VIEWS_TEST_SCOPED_VIEWS_TEST_HELPER_H_
6 #define UI_VIEWS_TEST_SCOPED_VIEWS_TEST_HELPER_H_ 6 #define UI_VIEWS_TEST_SCOPED_VIEWS_TEST_HELPER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "ui/gfx/native_widget_types.h" 11 #include "ui/gfx/native_widget_types.h"
12 12
13 namespace views { 13 namespace views {
14 14
15 class PlatformTestHelper; 15 class PlatformTestHelper;
16 class TestViewsDelegate; 16 class TestViewsDelegate;
17 class ViewsTestHelper; 17 class ViewsTestHelper;
18 class Widget;
18 19
19 // Creates a ViewsTestHelper that is destroyed automatically. Acts like 20 // Creates a ViewsTestHelper that is destroyed automatically. Acts like
20 // ViewsTestBase but allows a test harness to use a different base class, or 21 // ViewsTestBase but allows a test harness to use a different base class, or
21 // make use of a TestBrowserThreadBundle, rather than the MessageLoop provided 22 // make use of a TestBrowserThreadBundle, rather than the MessageLoop provided
22 // by ViewsTestBase. 23 // by ViewsTestBase.
23 class ScopedViewsTestHelper { 24 class ScopedViewsTestHelper {
24 public: 25 public:
25 // Initialize with the default TestViewsDelegate, MessageLoopForUI::current() 26 // Initialize with the default TestViewsDelegate, MessageLoopForUI::current()
26 // and the default test ContextFactory. 27 // and the default test ContextFactory.
27 ScopedViewsTestHelper(); 28 ScopedViewsTestHelper();
28 29
29 // Initialize with the given TestViewsDelegate instance, after setting the 30 // Initialize with the given TestViewsDelegate instance, after setting the
30 // ContextFactory. 31 // ContextFactory.
31 explicit ScopedViewsTestHelper( 32 explicit ScopedViewsTestHelper(
32 std::unique_ptr<TestViewsDelegate> views_delegate); 33 std::unique_ptr<TestViewsDelegate> views_delegate);
33 34
34 ~ScopedViewsTestHelper(); 35 ~ScopedViewsTestHelper();
35 36
36 // Returns the context for creating new windows. In Aura builds, this will be 37 // Returns the context for creating new windows. In Aura builds, this will be
37 // the RootWindow. Everywhere else, null. 38 // the RootWindow. Everywhere else, null.
38 gfx::NativeWindow GetContext(); 39 gfx::NativeWindow GetContext();
39 40
41 // Call this method to turn on full keyboard access for the given Widget. Note
42 // this is only used on Mac.
43 void SetFullKeyboardAccessState(Widget* widget, bool state);
44
40 TestViewsDelegate* views_delegate() { return views_delegate_.get(); }; 45 TestViewsDelegate* views_delegate() { return views_delegate_.get(); };
41 46
42 PlatformTestHelper* platform_test_helper() { 47 PlatformTestHelper* platform_test_helper() {
43 return platform_test_helper_.get(); 48 return platform_test_helper_.get();
44 } 49 }
45 50
46 private: 51 private:
47 std::unique_ptr<TestViewsDelegate> views_delegate_; 52 std::unique_ptr<TestViewsDelegate> views_delegate_;
48 std::unique_ptr<ViewsTestHelper> test_helper_; 53 std::unique_ptr<ViewsTestHelper> test_helper_;
49 std::unique_ptr<PlatformTestHelper> platform_test_helper_; 54 std::unique_ptr<PlatformTestHelper> platform_test_helper_;
50 55
51 DISALLOW_COPY_AND_ASSIGN(ScopedViewsTestHelper); 56 DISALLOW_COPY_AND_ASSIGN(ScopedViewsTestHelper);
52 }; 57 };
53 58
54 } // namespace views 59 } // namespace views
55 60
56 #endif // UI_VIEWS_TEST_SCOPED_VIEWS_TEST_HELPER_H_ 61 #endif // UI_VIEWS_TEST_SCOPED_VIEWS_TEST_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | ui/views/test/scoped_views_test_helper.cc » ('j') | ui/views/window/dialog_delegate_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698