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

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

Issue 181503009: Rename BaseNativeAppWindowViews and NativeAppWindowViews (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase (native_app_window) Created 6 years, 9 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 | Annotate | Revision Log
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 "chrome/browser/ui/views/apps/native_app_window_views.h" 7 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views.h"
8 #include "ui/aura/test/aura_test_base.h" 8 #include "ui/aura/test/aura_test_base.h"
9 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
10 #include "ui/aura/window_event_dispatcher.h" 10 #include "ui/aura/window_event_dispatcher.h"
11 #include "ui/views/controls/webview/webview.h" 11 #include "ui/views/controls/webview/webview.h"
12 #include "ui/wm/public/easy_resize_window_targeter.h" 12 #include "ui/wm/public/easy_resize_window_targeter.h"
13 13
14 class ShapedAppWindowTargeterTest : public aura::test::AuraTestBase { 14 class ShapedAppWindowTargeterTest : public aura::test::AuraTestBase {
15 public: 15 public:
16 ShapedAppWindowTargeterTest() 16 ShapedAppWindowTargeterTest()
17 : web_view_(NULL) { 17 : web_view_(NULL) {
18 } 18 }
19 19
20 virtual ~ShapedAppWindowTargeterTest() {} 20 virtual ~ShapedAppWindowTargeterTest() {}
21 21
22 views::Widget* widget() { return widget_.get(); } 22 views::Widget* widget() { return widget_.get(); }
23 23
24 apps::NativeAppWindow* app_window() { return &app_window_; } 24 apps::NativeAppWindow* app_window() { return &app_window_; }
25 NativeAppWindowViews* app_window_views() { return &app_window_; } 25 ChromeNativeAppWindowViews* app_window_views() { return &app_window_; }
26 26
27 protected: 27 protected:
28 virtual void SetUp() OVERRIDE { 28 virtual void SetUp() OVERRIDE {
29 aura::test::AuraTestBase::SetUp(); 29 aura::test::AuraTestBase::SetUp();
30 widget_.reset(new views::Widget); 30 widget_.reset(new views::Widget);
31 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); 31 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
32 params.remove_standard_frame = true; 32 params.remove_standard_frame = true;
33 params.bounds = gfx::Rect(30, 30, 100, 100); 33 params.bounds = gfx::Rect(30, 30, 100, 100);
34 params.context = root_window(); 34 params.context = root_window();
35 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 35 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
36 widget_->Init(params); 36 widget_->Init(params);
37 37
38 app_window_.set_web_view_for_testing(&web_view_); 38 app_window_.set_web_view_for_testing(&web_view_);
39 app_window_.set_window_for_testing(widget_.get()); 39 app_window_.set_window_for_testing(widget_.get());
40 40
41 widget_->Show(); 41 widget_->Show();
42 } 42 }
43 43
44 virtual void TearDown() OVERRIDE { 44 virtual void TearDown() OVERRIDE {
45 widget_.reset(); 45 widget_.reset();
46 aura::test::AuraTestBase::TearDown(); 46 aura::test::AuraTestBase::TearDown();
47 } 47 }
48 48
49 private: 49 private:
50 views::WebView web_view_; 50 views::WebView web_view_;
51 scoped_ptr<views::Widget> widget_; 51 scoped_ptr<views::Widget> widget_;
52 NativeAppWindowViews app_window_; 52 ChromeNativeAppWindowViews app_window_;
53 53
54 DISALLOW_COPY_AND_ASSIGN(ShapedAppWindowTargeterTest); 54 DISALLOW_COPY_AND_ASSIGN(ShapedAppWindowTargeterTest);
55 }; 55 };
56 56
57 TEST_F(ShapedAppWindowTargeterTest, HitTestBasic) { 57 TEST_F(ShapedAppWindowTargeterTest, HitTestBasic) {
58 aura::Window* window = widget()->GetNativeWindow(); 58 aura::Window* window = widget()->GetNativeWindow();
59 { 59 {
60 // Without any custom shapes, the event should be targeted correctly to the 60 // Without any custom shapes, the event should be targeted correctly to the
61 // window. 61 // window.
62 ui::MouseEvent move(ui::ET_MOUSE_MOVED, 62 ui::MouseEvent move(ui::ET_MOUSE_MOVED,
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 // inside the window and within 5px of an edge should have 194 // inside the window and within 5px of an edge should have
195 // root_window() as its target. 195 // root_window() as its target.
196 ui::MouseEvent move(ui::ET_MOUSE_MOVED, 196 ui::MouseEvent move(ui::ET_MOUSE_MOVED,
197 gfx::Point(32, 37), gfx::Point(32, 37), 197 gfx::Point(32, 37), gfx::Point(32, 37),
198 ui::EF_NONE, ui::EF_NONE); 198 ui::EF_NONE, ui::EF_NONE);
199 ui::EventDispatchDetails details = dispatcher()->OnEventFromSource(&move); 199 ui::EventDispatchDetails details = dispatcher()->OnEventFromSource(&move);
200 ASSERT_FALSE(details.dispatcher_destroyed); 200 ASSERT_FALSE(details.dispatcher_destroyed);
201 EXPECT_EQ(root_window(), move.target()); 201 EXPECT_EQ(root_window(), move.target());
202 } 202 }
203 } 203 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/apps/shaped_app_window_targeter.cc ('k') | chrome/browser/ui/views/frame/browser_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698