OLD | NEW |
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.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/views/controls/webview/webview.h" | 12 #include "ui/views/controls/webview/webview.h" |
13 #include "ui/wm/core/default_activation_client.h" | 13 #include "ui/wm/core/default_activation_client.h" |
14 #include "ui/wm/core/easy_resize_window_targeter.h" | 14 #include "ui/wm/core/easy_resize_window_targeter.h" |
15 | 15 |
16 class ShapedAppWindowTargeterTest : public aura::test::AuraTestBase { | 16 class ShapedAppWindowTargeterTest : public aura::test::AuraTestBase { |
17 public: | 17 public: |
18 ShapedAppWindowTargeterTest() | 18 ShapedAppWindowTargeterTest() |
19 : web_view_(NULL) { | 19 : web_view_(NULL) { |
20 } | 20 } |
21 | 21 |
22 virtual ~ShapedAppWindowTargeterTest() {} | 22 virtual ~ShapedAppWindowTargeterTest() {} |
23 | 23 |
24 views::Widget* widget() { return widget_.get(); } | 24 views::Widget* widget() { return widget_.get(); } |
25 | 25 |
26 extensions::NativeAppWindow* app_window() { return &app_window_; } | 26 extensions::NativeAppWindow* app_window() { return &app_window_; } |
27 ChromeNativeAppWindowViews* app_window_views() { return &app_window_; } | 27 ChromeNativeAppWindowViews* app_window_views() { return &app_window_; } |
28 | 28 |
29 protected: | 29 protected: |
30 virtual void SetUp() OVERRIDE { | 30 virtual void SetUp() override { |
31 aura::test::AuraTestBase::SetUp(); | 31 aura::test::AuraTestBase::SetUp(); |
32 new wm::DefaultActivationClient(root_window()); | 32 new wm::DefaultActivationClient(root_window()); |
33 widget_.reset(new views::Widget); | 33 widget_.reset(new views::Widget); |
34 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | 34 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
35 params.remove_standard_frame = true; | 35 params.remove_standard_frame = true; |
36 params.bounds = gfx::Rect(30, 30, 100, 100); | 36 params.bounds = gfx::Rect(30, 30, 100, 100); |
37 params.context = root_window(); | 37 params.context = root_window(); |
38 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 38 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
39 widget_->Init(params); | 39 widget_->Init(params); |
40 | 40 |
41 app_window_.set_web_view_for_testing(&web_view_); | 41 app_window_.set_web_view_for_testing(&web_view_); |
42 app_window_.set_window_for_testing(widget_.get()); | 42 app_window_.set_window_for_testing(widget_.get()); |
43 | 43 |
44 widget_->Show(); | 44 widget_->Show(); |
45 } | 45 } |
46 | 46 |
47 virtual void TearDown() OVERRIDE { | 47 virtual void TearDown() override { |
48 widget_.reset(); | 48 widget_.reset(); |
49 aura::test::AuraTestBase::TearDown(); | 49 aura::test::AuraTestBase::TearDown(); |
50 } | 50 } |
51 | 51 |
52 private: | 52 private: |
53 views::WebView web_view_; | 53 views::WebView web_view_; |
54 scoped_ptr<views::Widget> widget_; | 54 scoped_ptr<views::Widget> widget_; |
55 ChromeNativeAppWindowViews app_window_; | 55 ChromeNativeAppWindowViews app_window_; |
56 | 56 |
57 DISALLOW_COPY_AND_ASSIGN(ShapedAppWindowTargeterTest); | 57 DISALLOW_COPY_AND_ASSIGN(ShapedAppWindowTargeterTest); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 ui::MouseEvent move(ui::ET_MOUSE_MOVED, | 246 ui::MouseEvent move(ui::ET_MOUSE_MOVED, |
247 gfx::Point(32, 37), gfx::Point(32, 37), | 247 gfx::Point(32, 37), gfx::Point(32, 37), |
248 ui::EF_NONE, ui::EF_NONE); | 248 ui::EF_NONE, ui::EF_NONE); |
249 ui::EventDispatchDetails details = | 249 ui::EventDispatchDetails details = |
250 event_processor()->OnEventFromSource(&move); | 250 event_processor()->OnEventFromSource(&move); |
251 ASSERT_FALSE(details.dispatcher_destroyed); | 251 ASSERT_FALSE(details.dispatcher_destroyed); |
252 EXPECT_EQ(window, move.target()); | 252 EXPECT_EQ(window, move.target()); |
253 } | 253 } |
254 #endif // defined (OS_CHROMEOS) | 254 #endif // defined (OS_CHROMEOS) |
255 } | 255 } |
OLD | NEW |