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

Side by Side Diff: chrome/browser/ui/views/apps/shaped_app_window_targeter_unittest.cc

Issue 947343003: Split out Ash/Aura parts of ChromeNativeAppWindowViews. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ready for review. Created 5 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/ui/views/apps/shaped_app_window_targeter.h" 5 #include "chrome/browser/ui/views/apps/shaped_app_window_targeter.h"
6 6
7 #include "apps/ui/views/app_window_frame_view.h" 7 #include "apps/ui/views/app_window_frame_view.h"
8 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views.h" 8 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.h"
9 #include "ui/aura/test/aura_test_base.h" 9 #include "ui/aura/test/aura_test_base.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
11 #include "ui/aura/window_event_dispatcher.h" 11 #include "ui/aura/window_event_dispatcher.h"
12 #include "ui/events/event_utils.h" 12 #include "ui/events/event_utils.h"
13 #include "ui/views/controls/webview/webview.h" 13 #include "ui/views/controls/webview/webview.h"
14 #include "ui/wm/core/default_activation_client.h" 14 #include "ui/wm/core/default_activation_client.h"
15 #include "ui/wm/core/easy_resize_window_targeter.h" 15 #include "ui/wm/core/easy_resize_window_targeter.h"
16 16
17 class ShapedAppWindowTargeterTest : public aura::test::AuraTestBase { 17 class ShapedAppWindowTargeterTest : public aura::test::AuraTestBase {
18 public: 18 public:
19 ShapedAppWindowTargeterTest() 19 ShapedAppWindowTargeterTest()
20 : web_view_(NULL) { 20 : web_view_(NULL) {
21 } 21 }
22 22
23 ~ShapedAppWindowTargeterTest() override {} 23 ~ShapedAppWindowTargeterTest() override {}
24 24
25 views::Widget* widget() { return widget_.get(); } 25 views::Widget* widget() { return widget_.get(); }
26 26
27 extensions::NativeAppWindow* app_window() { return &app_window_; } 27 extensions::NativeAppWindow* app_window() { return &app_window_; }
28 ChromeNativeAppWindowViews* app_window_views() { return &app_window_; } 28 ChromeNativeAppWindowViewsAura* app_window_views() { return &app_window_; }
29 29
30 protected: 30 protected:
31 void SetUp() override { 31 void SetUp() override {
32 aura::test::AuraTestBase::SetUp(); 32 aura::test::AuraTestBase::SetUp();
33 new wm::DefaultActivationClient(root_window()); 33 new wm::DefaultActivationClient(root_window());
34 widget_.reset(new views::Widget); 34 widget_.reset(new views::Widget);
35 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); 35 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
36 params.remove_standard_frame = true; 36 params.remove_standard_frame = true;
37 params.bounds = gfx::Rect(30, 30, 100, 100); 37 params.bounds = gfx::Rect(30, 30, 100, 100);
38 params.context = root_window(); 38 params.context = root_window();
39 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 39 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
40 widget_->Init(params); 40 widget_->Init(params);
41 41
42 app_window_.set_web_view_for_testing(&web_view_); 42 app_window_.set_web_view_for_testing(&web_view_);
43 app_window_.set_window_for_testing(widget_.get()); 43 app_window_.set_window_for_testing(widget_.get());
44 44
45 widget_->Show(); 45 widget_->Show();
46 } 46 }
47 47
48 void TearDown() override { 48 void TearDown() override {
49 widget_.reset(); 49 widget_.reset();
50 aura::test::AuraTestBase::TearDown(); 50 aura::test::AuraTestBase::TearDown();
51 } 51 }
52 52
53 private: 53 private:
54 views::WebView web_view_; 54 views::WebView web_view_;
55 scoped_ptr<views::Widget> widget_; 55 scoped_ptr<views::Widget> widget_;
56 ChromeNativeAppWindowViews app_window_; 56 ChromeNativeAppWindowViewsAura app_window_;
57 57
58 DISALLOW_COPY_AND_ASSIGN(ShapedAppWindowTargeterTest); 58 DISALLOW_COPY_AND_ASSIGN(ShapedAppWindowTargeterTest);
59 }; 59 };
60 60
61 TEST_F(ShapedAppWindowTargeterTest, HitTestBasic) { 61 TEST_F(ShapedAppWindowTargeterTest, HitTestBasic) {
62 aura::Window* window = widget()->GetNativeWindow(); 62 aura::Window* window = widget()->GetNativeWindow();
63 { 63 {
64 // Without any custom shapes, the event should be targeted correctly to the 64 // Without any custom shapes, the event should be targeted correctly to the
65 // window. 65 // window.
66 ui::MouseEvent move(ui::ET_MOUSE_MOVED, gfx::Point(40, 40), 66 ui::MouseEvent move(ui::ET_MOUSE_MOVED, gfx::Point(40, 40),
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 ui::MouseEvent move(ui::ET_MOUSE_MOVED, gfx::Point(32, 37), 247 ui::MouseEvent move(ui::ET_MOUSE_MOVED, gfx::Point(32, 37),
248 gfx::Point(32, 37), ui::EventTimeForNow(), ui::EF_NONE, 248 gfx::Point(32, 37), ui::EventTimeForNow(), ui::EF_NONE,
249 ui::EF_NONE); 249 ui::EF_NONE);
250 ui::EventDispatchDetails details = 250 ui::EventDispatchDetails details =
251 event_processor()->OnEventFromSource(&move); 251 event_processor()->OnEventFromSource(&move);
252 ASSERT_FALSE(details.dispatcher_destroyed); 252 ASSERT_FALSE(details.dispatcher_destroyed);
253 EXPECT_EQ(window, move.target()); 253 EXPECT_EQ(window, move.target());
254 } 254 }
255 #endif // defined (OS_CHROMEOS) 255 #endif // defined (OS_CHROMEOS)
256 } 256 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698