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

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

Issue 1372253002: gfx: Make conversions from gfx::Point to PointF explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pointfconvert-gfx: . Created 5 years, 2 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 (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 "ui/views/widget/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 view->AddChildView(child); 302 view->AddChildView(child);
303 scoped_ptr<TestWidget> widget(new TestWidget()); 303 scoped_ptr<TestWidget> widget(new TestWidget());
304 Widget::InitParams params(Widget::InitParams::TYPE_WINDOW_FRAMELESS); 304 Widget::InitParams params(Widget::InitParams::TYPE_WINDOW_FRAMELESS);
305 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 305 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
306 params.context = root_window(); 306 params.context = root_window();
307 params.bounds = gfx::Rect(0, 0, 100, 200); 307 params.bounds = gfx::Rect(0, 0, 100, 200);
308 widget->Init(params); 308 widget->Init(params);
309 widget->SetContentsView(view); 309 widget->SetContentsView(view);
310 widget->Show(); 310 widget->Show();
311 311
312 ui::TouchEvent press( 312 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::PointF(41.f, 51.f), 1,
313 ui::ET_TOUCH_PRESSED, gfx::Point(41, 51), 1, ui::EventTimeForNow()); 313 ui::EventTimeForNow());
314 ui::EventDispatchDetails details = 314 ui::EventDispatchDetails details =
315 event_processor()->OnEventFromSource(&press); 315 event_processor()->OnEventFromSource(&press);
316 ASSERT_FALSE(details.dispatcher_destroyed); 316 ASSERT_FALSE(details.dispatcher_destroyed);
317 // Both views should get the press. 317 // Both views should get the press.
318 EXPECT_TRUE(view->got_gesture_event()); 318 EXPECT_TRUE(view->got_gesture_event());
319 EXPECT_TRUE(child->got_gesture_event()); 319 EXPECT_TRUE(child->got_gesture_event());
320 view->clear_got_gesture_event(); 320 view->clear_got_gesture_event();
321 child->clear_got_gesture_event(); 321 child->clear_got_gesture_event();
322 // Touch events should not automatically grab capture. 322 // Touch events should not automatically grab capture.
323 EXPECT_FALSE(widget->HasCapture()); 323 EXPECT_FALSE(widget->HasCapture());
324 324
325 // Release touch. Only |view| should get the release since that it consumed 325 // Release touch. Only |view| should get the release since that it consumed
326 // the press. 326 // the press.
327 ui::TouchEvent release( 327 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::PointF(250.f, 251.f), 1,
328 ui::ET_TOUCH_RELEASED, gfx::Point(250, 251), 1, ui::EventTimeForNow()); 328 ui::EventTimeForNow());
329 details = event_processor()->OnEventFromSource(&release); 329 details = event_processor()->OnEventFromSource(&release);
330 ASSERT_FALSE(details.dispatcher_destroyed); 330 ASSERT_FALSE(details.dispatcher_destroyed);
331 EXPECT_TRUE(view->got_gesture_event()); 331 EXPECT_TRUE(view->got_gesture_event());
332 EXPECT_FALSE(child->got_gesture_event()); 332 EXPECT_FALSE(child->got_gesture_event());
333 view->clear_got_gesture_event(); 333 view->clear_got_gesture_event();
334 334
335 // Work around for bug in NativeWidgetAura. 335 // Work around for bug in NativeWidgetAura.
336 // TODO: fix bug and remove this. 336 // TODO: fix bug and remove this.
337 widget->Close(); 337 widget->Close();
338 } 338 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 delegate->ClearGotMove(); 465 delegate->ClearGotMove();
466 // Simulate a maximize with animation. 466 // Simulate a maximize with animation.
467 delete widget->GetNativeView()->RecreateLayer().release(); 467 delete widget->GetNativeView()->RecreateLayer().release();
468 widget->SetBounds(gfx::Rect(0, 0, 500, 500)); 468 widget->SetBounds(gfx::Rect(0, 0, 500, 500));
469 EXPECT_TRUE(delegate->got_move()); 469 EXPECT_TRUE(delegate->got_move());
470 widget->CloseNow(); 470 widget->CloseNow();
471 } 471 }
472 472
473 } // namespace 473 } // namespace
474 } // namespace views 474 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698