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

Side by Side Diff: ui/views/widget/widget_unittest.cc

Issue 76583003: Rename RootWindowHost* to WindowTreeHost* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/widget/widget_interactive_uitest.cc ('k') | ui/views/win/hwnd_message_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include <algorithm> 5 #include <algorithm>
6 #include <set> 6 #include <set>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 1284
1285 DISALLOW_COPY_AND_ASSIGN(CloseWidgetView); 1285 DISALLOW_COPY_AND_ASSIGN(CloseWidgetView);
1286 }; 1286 };
1287 1287
1288 // Generates two moves (first generates enter, second real move), a press, drag 1288 // Generates two moves (first generates enter, second real move), a press, drag
1289 // and release stopping at |last_event_type|. 1289 // and release stopping at |last_event_type|.
1290 void GenerateMouseEvents(Widget* widget, ui::EventType last_event_type) { 1290 void GenerateMouseEvents(Widget* widget, ui::EventType last_event_type) {
1291 const gfx::Rect screen_bounds(widget->GetWindowBoundsInScreen()); 1291 const gfx::Rect screen_bounds(widget->GetWindowBoundsInScreen());
1292 ui::MouseEvent move_event(ui::ET_MOUSE_MOVED, screen_bounds.CenterPoint(), 1292 ui::MouseEvent move_event(ui::ET_MOUSE_MOVED, screen_bounds.CenterPoint(),
1293 screen_bounds.CenterPoint(), 0, 0); 1293 screen_bounds.CenterPoint(), 0, 0);
1294 aura::RootWindowHostDelegate* rwhd = 1294 aura::WindowTreeHostDelegate* rwhd =
1295 widget->GetNativeWindow()->GetDispatcher()->AsRootWindowHostDelegate(); 1295 widget->GetNativeWindow()->GetDispatcher()->AsWindowTreeHostDelegate();
1296 rwhd->OnHostMouseEvent(&move_event); 1296 rwhd->OnHostMouseEvent(&move_event);
1297 if (last_event_type == ui::ET_MOUSE_ENTERED) 1297 if (last_event_type == ui::ET_MOUSE_ENTERED)
1298 return; 1298 return;
1299 rwhd->OnHostMouseEvent(&move_event); 1299 rwhd->OnHostMouseEvent(&move_event);
1300 if (last_event_type == ui::ET_MOUSE_MOVED) 1300 if (last_event_type == ui::ET_MOUSE_MOVED)
1301 return; 1301 return;
1302 1302
1303 ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, screen_bounds.CenterPoint(), 1303 ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, screen_bounds.CenterPoint(),
1304 screen_bounds.CenterPoint(), 0, 0); 1304 screen_bounds.CenterPoint(), 0, 0);
1305 rwhd->OnHostMouseEvent(&press_event); 1305 rwhd->OnHostMouseEvent(&press_event);
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
2048 widget_view->SetBounds(0, 0, 10, 10); 2048 widget_view->SetBounds(0, 0, 10, 10);
2049 top_level_widget.GetRootView()->AddChildView(widget_view); 2049 top_level_widget.GetRootView()->AddChildView(widget_view);
2050 2050
2051 gfx::Point cursor_location_main(5, 5); 2051 gfx::Point cursor_location_main(5, 5);
2052 ui::MouseEvent move_main(ui::ET_MOUSE_MOVED, 2052 ui::MouseEvent move_main(ui::ET_MOUSE_MOVED,
2053 cursor_location_main, 2053 cursor_location_main,
2054 cursor_location_main, 2054 cursor_location_main,
2055 ui::EF_NONE, 2055 ui::EF_NONE,
2056 ui::EF_NONE); 2056 ui::EF_NONE);
2057 top_level_widget.GetNativeView()->GetDispatcher()-> 2057 top_level_widget.GetNativeView()->GetDispatcher()->
2058 AsRootWindowHostDelegate()->OnHostMouseEvent(&move_main); 2058 AsWindowTreeHostDelegate()->OnHostMouseEvent(&move_main);
2059 2059
2060 EXPECT_EQ(1, widget_view->GetEventCount(ui::ET_MOUSE_ENTERED)); 2060 EXPECT_EQ(1, widget_view->GetEventCount(ui::ET_MOUSE_ENTERED));
2061 widget_view->ResetCounts(); 2061 widget_view->ResetCounts();
2062 2062
2063 // Create a modal dialog and validate that a mouse down message makes it to 2063 // Create a modal dialog and validate that a mouse down message makes it to
2064 // the main view within the dialog. 2064 // the main view within the dialog.
2065 2065
2066 // This instance will be destroyed when the dialog is destroyed. 2066 // This instance will be destroyed when the dialog is destroyed.
2067 ModalDialogDelegate* dialog_delegate = new ModalDialogDelegate; 2067 ModalDialogDelegate* dialog_delegate = new ModalDialogDelegate;
2068 2068
2069 Widget* modal_dialog_widget = views::DialogDelegate::CreateDialogWidget( 2069 Widget* modal_dialog_widget = views::DialogDelegate::CreateDialogWidget(
2070 dialog_delegate, NULL, top_level_widget.GetNativeWindow()); 2070 dialog_delegate, NULL, top_level_widget.GetNativeWindow());
2071 modal_dialog_widget->SetBounds(gfx::Rect(100, 100, 200, 200)); 2071 modal_dialog_widget->SetBounds(gfx::Rect(100, 100, 200, 200));
2072 EventCountView* dialog_widget_view = new EventCountView(); 2072 EventCountView* dialog_widget_view = new EventCountView();
2073 dialog_widget_view->SetBounds(0, 0, 50, 50); 2073 dialog_widget_view->SetBounds(0, 0, 50, 50);
2074 modal_dialog_widget->GetRootView()->AddChildView(dialog_widget_view); 2074 modal_dialog_widget->GetRootView()->AddChildView(dialog_widget_view);
2075 modal_dialog_widget->Show(); 2075 modal_dialog_widget->Show();
2076 EXPECT_TRUE(modal_dialog_widget->IsVisible()); 2076 EXPECT_TRUE(modal_dialog_widget->IsVisible());
2077 2077
2078 gfx::Point cursor_location_dialog(100, 100); 2078 gfx::Point cursor_location_dialog(100, 100);
2079 ui::MouseEvent mouse_down_dialog(ui::ET_MOUSE_PRESSED, 2079 ui::MouseEvent mouse_down_dialog(ui::ET_MOUSE_PRESSED,
2080 cursor_location_dialog, 2080 cursor_location_dialog,
2081 cursor_location_dialog, 2081 cursor_location_dialog,
2082 ui::EF_NONE, 2082 ui::EF_NONE,
2083 ui::EF_NONE); 2083 ui::EF_NONE);
2084 top_level_widget.GetNativeView()->GetDispatcher()-> 2084 top_level_widget.GetNativeView()->GetDispatcher()->
2085 AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_down_dialog); 2085 AsWindowTreeHostDelegate()->OnHostMouseEvent(&mouse_down_dialog);
2086 EXPECT_EQ(1, dialog_widget_view->GetEventCount(ui::ET_MOUSE_PRESSED)); 2086 EXPECT_EQ(1, dialog_widget_view->GetEventCount(ui::ET_MOUSE_PRESSED));
2087 2087
2088 // Send a mouse move message to the main window. It should not be received by 2088 // Send a mouse move message to the main window. It should not be received by
2089 // the main window as the modal dialog is still active. 2089 // the main window as the modal dialog is still active.
2090 gfx::Point cursor_location_main2(6, 6); 2090 gfx::Point cursor_location_main2(6, 6);
2091 ui::MouseEvent mouse_down_main(ui::ET_MOUSE_MOVED, 2091 ui::MouseEvent mouse_down_main(ui::ET_MOUSE_MOVED,
2092 cursor_location_main2, 2092 cursor_location_main2,
2093 cursor_location_main2, 2093 cursor_location_main2,
2094 ui::EF_NONE, 2094 ui::EF_NONE,
2095 ui::EF_NONE); 2095 ui::EF_NONE);
2096 top_level_widget.GetNativeView()->GetDispatcher()-> 2096 top_level_widget.GetNativeView()->GetDispatcher()->
2097 AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_down_main); 2097 AsWindowTreeHostDelegate()->OnHostMouseEvent(&mouse_down_main);
2098 EXPECT_EQ(0, widget_view->GetEventCount(ui::ET_MOUSE_MOVED)); 2098 EXPECT_EQ(0, widget_view->GetEventCount(ui::ET_MOUSE_MOVED));
2099 2099
2100 modal_dialog_widget->CloseNow(); 2100 modal_dialog_widget->CloseNow();
2101 top_level_widget.CloseNow(); 2101 top_level_widget.CloseNow();
2102 } 2102 }
2103 2103
2104 #if defined(USE_AURA) 2104 #if defined(USE_AURA)
2105 // Verifies nativeview visbility matches that of Widget visibility when 2105 // Verifies nativeview visbility matches that of Widget visibility when
2106 // SetFullscreen is invoked. 2106 // SetFullscreen is invoked.
2107 TEST_F(WidgetTest, FullscreenStatePropagated) { 2107 TEST_F(WidgetTest, FullscreenStatePropagated) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2223 EXPECT_EQ(activate_result, MA_ACTIVATE); 2223 EXPECT_EQ(activate_result, MA_ACTIVATE);
2224 2224
2225 modal_dialog_widget->CloseNow(); 2225 modal_dialog_widget->CloseNow();
2226 top_level_widget.CloseNow(); 2226 top_level_widget.CloseNow();
2227 } 2227 }
2228 #endif 2228 #endif
2229 #endif 2229 #endif
2230 2230
2231 } // namespace test 2231 } // namespace test
2232 } // namespace views 2232 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/widget_interactive_uitest.cc ('k') | ui/views/win/hwnd_message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698