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

Side by Side Diff: chrome/browser/ui/views/autofill/autofill_popup_base_view_browsertest.cc

Issue 397293005: Fix positioning of children of NativeViewHostAura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: delete test Created 6 years, 5 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/autofill/autofill_popup_base_view.h" 5 #include "chrome/browser/ui/views/autofill/autofill_popup_base_view.h"
6 6
7 #include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h" 7 #include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_window.h" 9 #include "chrome/browser/ui/browser_window.h"
10 #include "chrome/browser/ui/tabs/tab_strip_model.h"
10 #include "chrome/test/base/in_process_browser_test.h" 11 #include "chrome/test/base/in_process_browser_test.h"
11 #include "testing/gmock/include/gmock/gmock.h" 12 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 #include "ui/events/event_utils.h" 14 #include "ui/events/event_utils.h"
14 #include "ui/views/test/views_test_base.h" 15 #include "ui/views/test/views_test_base.h"
15 #include "ui/views/widget/widget.h" 16 #include "ui/views/widget/widget.h"
16 17
17 namespace autofill { 18 namespace autofill {
18 19
19 namespace { 20 namespace {
(...skipping 14 matching lines...) Expand all
34 }; 35 };
35 36
36 } // namespace 37 } // namespace
37 38
38 class AutofillPopupBaseViewTest : public InProcessBrowserTest { 39 class AutofillPopupBaseViewTest : public InProcessBrowserTest {
39 public: 40 public:
40 AutofillPopupBaseViewTest() {} 41 AutofillPopupBaseViewTest() {}
41 virtual ~AutofillPopupBaseViewTest() {} 42 virtual ~AutofillPopupBaseViewTest() {}
42 43
43 virtual void SetUpOnMainThread() OVERRIDE { 44 virtual void SetUpOnMainThread() OVERRIDE {
44 gfx::NativeWindow window = browser()->window()->GetNativeWindow(); 45 gfx::NativeView native_view =
46 browser()->tab_strip_model()->GetActiveWebContents()->GetNativeView();
45 EXPECT_CALL(mock_delegate_, container_view()) 47 EXPECT_CALL(mock_delegate_, container_view())
46 .WillRepeatedly(Return(window)); 48 .WillRepeatedly(Return(native_view));
47 EXPECT_CALL(mock_delegate_, ViewDestroyed()); 49 EXPECT_CALL(mock_delegate_, ViewDestroyed());
48 50
49 view_ = new AutofillPopupBaseView( 51 view_ =
50 &mock_delegate_, 52 new AutofillPopupBaseView(&mock_delegate_,
51 views::Widget::GetWidgetForNativeWindow(window)); 53 views::Widget::GetWidgetForNativeWindow(
54 browser()->window()->GetNativeWindow()));
52 } 55 }
53 56
54 void ShowView() { 57 void ShowView() {
55 view_->DoShow(); 58 view_->DoShow();
56 } 59 }
57 60
58 ui::GestureEvent CreateGestureEvent(ui::EventType type, gfx::Point point) { 61 ui::GestureEvent CreateGestureEvent(ui::EventType type, gfx::Point point) {
59 return ui::GestureEvent(point.x(), 62 return ui::GestureEvent(point.x(),
60 point.y(), 63 point.y(),
61 0, 64 0,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 gfx::Point(0, 0), 124 gfx::Point(0, 0),
122 gfx::Point(0, 0), 125 gfx::Point(0, 0),
123 0, 0); 126 0, 0);
124 EXPECT_TRUE(static_cast<views::View*>(view_)->OnMousePressed(mouse_down)); 127 EXPECT_TRUE(static_cast<views::View*>(view_)->OnMousePressed(mouse_down));
125 128
126 // Ignore double clicks. 129 // Ignore double clicks.
127 mouse_down.SetClickCount(2); 130 mouse_down.SetClickCount(2);
128 EXPECT_FALSE(static_cast<views::View*>(view_)->OnMousePressed(mouse_down)); 131 EXPECT_FALSE(static_cast<views::View*>(view_)->OnMousePressed(mouse_down));
129 } 132 }
130 133
134 // Regression test for crbug.com/391316
135 IN_PROC_BROWSER_TEST_F(AutofillPopupBaseViewTest, CorrectBoundsTest) {
136 gfx::Rect bounds(100, 150, 5, 5);
137 EXPECT_CALL(mock_delegate_, popup_bounds()).WillRepeatedly(ReturnRef(bounds));
138
139 ShowView();
140
141 gfx::Point display_point =
142 static_cast<views::View*>(view_)->GetBoundsInScreen().origin();
143 gfx::Point expected_point = bounds.origin();
144 EXPECT_EQ(expected_point, display_point);
145 }
146
131 } // namespace autofill 147 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/native/native_view_host_aura.cc » ('j') | ui/views/controls/native/native_view_host_aura.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698