| Index: ui/views/widget/widget_interactive_uitest.cc
|
| ===================================================================
|
| --- ui/views/widget/widget_interactive_uitest.cc (revision 257432)
|
| +++ ui/views/widget/widget_interactive_uitest.cc (working copy)
|
| @@ -4,13 +4,17 @@
|
|
|
| #include "base/basictypes.h"
|
| #include "base/bind.h"
|
| +#include "base/path_service.h"
|
| #include "base/run_loop.h"
|
| #include "ui/aura/client/activation_client.h"
|
| #include "ui/aura/client/focus_client.h"
|
| #include "ui/aura/env.h"
|
| #include "ui/aura/window.h"
|
| #include "ui/aura/window_event_dispatcher.h"
|
| +#include "ui/base/resource/resource_bundle.h"
|
| +#include "ui/base/ui_base_paths.h"
|
| #include "ui/gfx/native_widget_types.h"
|
| +#include "ui/gl/gl_surface.h"
|
| #include "ui/views/test/widget_test.h"
|
| #include "ui/views/widget/widget.h"
|
| #include "ui/views/window/dialog_delegate.h"
|
| @@ -142,6 +146,22 @@
|
|
|
| } // namespace
|
|
|
| +class WidgetTestInteractive : public WidgetTest {
|
| + public:
|
| + WidgetTestInteractive() {}
|
| + virtual ~WidgetTestInteractive() {}
|
| +
|
| + virtual void SetUp() OVERRIDE {
|
| + gfx::GLSurface::InitializeOneOffForTests();
|
| + base::FilePath pak_dir;
|
| + PathService::Get(base::DIR_MODULE, &pak_dir);
|
| + base::FilePath pak_file;
|
| + pak_file = pak_dir.Append(FILE_PATH_LITERAL("ui_test.pak"));
|
| + ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file);
|
| + WidgetTest::SetUp();
|
| + }
|
| +};
|
| +
|
| #if defined(OS_WIN)
|
| // Tests whether activation and focus change works correctly in Windows.
|
| // We test the following:-
|
| @@ -153,7 +173,7 @@
|
| // window for widget 1 should be set and that for widget 2 should reset.
|
| // TODO(ananta)
|
| // Discuss with erg on how to write this test for linux x11 aura.
|
| -TEST_F(WidgetTest, DesktopNativeWidgetAuraActivationAndFocusTest) {
|
| +TEST_F(WidgetTestInteractive, DesktopNativeWidgetAuraActivationAndFocusTest) {
|
| // Create widget 1 and expect the active window to be its window.
|
| View* contents_view1 = new View;
|
| contents_view1->SetFocusable(true);
|
| @@ -209,7 +229,7 @@
|
| }
|
| #endif
|
|
|
| -TEST_F(WidgetTest, CaptureAutoReset) {
|
| +TEST_F(WidgetTestInteractive, CaptureAutoReset) {
|
| Widget* toplevel = CreateTopLevelFramelessPlatformWidget();
|
| View* container = new View;
|
| toplevel->SetContentsView(container);
|
| @@ -238,7 +258,7 @@
|
| RunPendingMessages();
|
| }
|
|
|
| -TEST_F(WidgetTest, ResetCaptureOnGestureEnd) {
|
| +TEST_F(WidgetTestInteractive, ResetCaptureOnGestureEnd) {
|
| Widget* toplevel = CreateTopLevelFramelessPlatformWidget();
|
| View* container = new View;
|
| toplevel->SetContentsView(container);
|
| @@ -294,7 +314,7 @@
|
| // Checks that if a mouse-press triggers a capture on a different widget (which
|
| // consumes the mouse-release event), then the target of the press does not have
|
| // capture.
|
| -TEST_F(WidgetTest, DisableCaptureWidgetFromMousePress) {
|
| +TEST_F(WidgetTestInteractive, DisableCaptureWidgetFromMousePress) {
|
| // The test creates two widgets: |first| and |second|.
|
| // The View in |first| makes |second| visible, sets capture on it, and starts
|
| // a nested loop (like a menu does). The View in |second| terminates the
|
| @@ -333,7 +353,7 @@
|
|
|
| // Tests some grab/ungrab events.
|
| // TODO(estade): can this be enabled now that this is an interactive ui test?
|
| -TEST_F(WidgetTest, DISABLED_GrabUngrab) {
|
| +TEST_F(WidgetTestInteractive, DISABLED_GrabUngrab) {
|
| Widget* toplevel = CreateTopLevelPlatformWidget();
|
| Widget* child1 = CreateChildNativeWidgetWithParent(toplevel);
|
| Widget* child2 = CreateChildNativeWidgetWithParent(toplevel);
|
| @@ -395,7 +415,7 @@
|
|
|
| // Tests mouse move outside of the window into the "resize controller" and back
|
| // will still generate an OnMouseEntered and OnMouseExited event..
|
| -TEST_F(WidgetTest, CheckResizeControllerEvents) {
|
| +TEST_F(WidgetTestInteractive, CheckResizeControllerEvents) {
|
| Widget* toplevel = CreateTopLevelPlatformWidget();
|
|
|
| toplevel->SetBounds(gfx::Rect(0, 0, 100, 100));
|
| @@ -471,7 +491,7 @@
|
|
|
| // Tests whether the widget only becomes active when the underlying window
|
| // is really active.
|
| -TEST_F(WidgetTest, WidgetNotActivatedOnFakeActivationMessages) {
|
| +TEST_F(WidgetTestInteractive, WidgetNotActivatedOnFakeActivationMessages) {
|
| WidgetActivationTest widget1;
|
| Widget::InitParams init_params =
|
| CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS);
|
| @@ -523,7 +543,7 @@
|
| // Tests whether the focused window is set correctly when a modal window is
|
| // created and destroyed. When it is destroyed it should focus the owner
|
| // window.
|
| -TEST_F(WidgetTest, WindowModalWindowDestroyedActivationTest) {
|
| +TEST_F(WidgetTestInteractive, WindowModalWindowDestroyedActivationTest) {
|
| // Create a top level widget.
|
| Widget top_level_widget;
|
| Widget::InitParams init_params =
|
| @@ -560,7 +580,7 @@
|
| }
|
|
|
| // Test that when opening a system-modal window, capture is released.
|
| -TEST_F(WidgetTest, SystemModalWindowReleasesCapture) {
|
| +TEST_F(WidgetTestInteractive, SystemModalWindowReleasesCapture) {
|
| // Create a top level widget.
|
| Widget top_level_widget;
|
| Widget::InitParams init_params =
|
| @@ -634,6 +654,16 @@
|
| virtual ~WidgetCaptureTest() {
|
| }
|
|
|
| + virtual void SetUp() OVERRIDE {
|
| + gfx::GLSurface::InitializeOneOffForTests();
|
| + base::FilePath pak_dir;
|
| + PathService::Get(base::DIR_MODULE, &pak_dir);
|
| + base::FilePath pak_file;
|
| + pak_file = pak_dir.Append(FILE_PATH_LITERAL("ui_test.pak"));
|
| + ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file);
|
| + ViewsTestBase::SetUp();
|
| + }
|
| +
|
| // Verifies Widget::SetCapture() results in updating native capture along with
|
| // invoking the right Widget function.
|
| void TestCapture(bool use_desktop_native_widget) {
|
|
|