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

Side by Side Diff: chrome/renderer/autofill/page_click_tracker_browsertest.cc

Issue 2501493002: Revert "MainFrame scrollbars should work with RFV instead of FV" (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <memory> 5 #include <memory>
6 6
7 #include "chrome/test/base/chrome_render_view_test.h" 7 #include "chrome/test/base/chrome_render_view_test.h"
8 #include "components/autofill/content/renderer/page_click_listener.h" 8 #include "components/autofill/content/renderer/page_click_listener.h"
9 #include "components/autofill/content/renderer/page_click_tracker.h" 9 #include "components/autofill/content/renderer/page_click_tracker.h"
10 #include "content/public/renderer/render_view.h" 10 #include "content/public/renderer/render_view.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "third_party/WebKit/public/platform/WebFloatPoint.h" 12 #include "third_party/WebKit/public/platform/WebFloatPoint.h"
13 #include "third_party/WebKit/public/platform/WebSize.h" 13 #include "third_party/WebKit/public/platform/WebSize.h"
14 #include "third_party/WebKit/public/web/WebDocument.h" 14 #include "third_party/WebKit/public/web/WebDocument.h"
15 #include "third_party/WebKit/public/web/WebInputElement.h" 15 #include "third_party/WebKit/public/web/WebInputElement.h"
16 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
17 #include "third_party/WebKit/public/web/WebSettings.h" 16 #include "third_party/WebKit/public/web/WebSettings.h"
18 #include "third_party/WebKit/public/web/WebView.h" 17 #include "third_party/WebKit/public/web/WebView.h"
19 #include "ui/events/keycodes/keyboard_codes.h" 18 #include "ui/events/keycodes/keyboard_codes.h"
20 #include "ui/native_theme/native_theme_switches.h"
21
22 using blink::WebRuntimeFeatures;
23 19
24 namespace autofill { 20 namespace autofill {
25 21
26 class TestPageClickListener : public PageClickListener { 22 class TestPageClickListener : public PageClickListener {
27 public: 23 public:
28 TestPageClickListener() 24 TestPageClickListener()
29 : form_control_element_clicked_called_(false), 25 : form_control_element_clicked_called_(false),
30 was_focused_(false) {} 26 was_focused_(false) {}
31 27
32 void FormControlElementClicked(const blink::WebFormControlElement& element, 28 void FormControlElementClicked(const blink::WebFormControlElement& element,
(...skipping 12 matching lines...) Expand all
45 bool form_control_element_clicked_called_; 41 bool form_control_element_clicked_called_;
46 blink::WebFormControlElement form_control_element_clicked_; 42 blink::WebFormControlElement form_control_element_clicked_;
47 bool was_focused_; 43 bool was_focused_;
48 }; 44 };
49 45
50 class PageClickTrackerTest : public ChromeRenderViewTest { 46 class PageClickTrackerTest : public ChromeRenderViewTest {
51 protected: 47 protected:
52 void SetUp() override { 48 void SetUp() override {
53 ChromeRenderViewTest::SetUp(); 49 ChromeRenderViewTest::SetUp();
54 50
55 WebRuntimeFeatures::enableOverlayScrollbars(
56 ui::IsOverlayScrollbarEnabled());
57
58 // RenderView creates PageClickTracker but it doesn't keep it around. 51 // RenderView creates PageClickTracker but it doesn't keep it around.
59 // Rather than make it do so for the test, we create a new object. 52 // Rather than make it do so for the test, we create a new object.
60 page_click_tracker_.reset(new PageClickTracker(view_->GetMainRenderFrame(), 53 page_click_tracker_.reset(new PageClickTracker(view_->GetMainRenderFrame(),
61 &test_listener_)); 54 &test_listener_));
62 55
63 // Must be set before loading HTML. 56 // Must be set before loading HTML.
64 view_->GetWebView()->setDefaultPageScaleLimits(1, 4); 57 view_->GetWebView()->setDefaultPageScaleLimits(1, 4);
65 58
66 LoadHTML("<form>" 59 LoadHTML("<form>"
67 " <input type='text' id='text_1'></input><br>" 60 " <input type='text' id='text_1'></input><br>"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 // Tap outside of element bounds, but tap width is overlapping the field. 239 // Tap outside of element bounds, but tap width is overlapping the field.
247 gfx::Rect element_bounds = GetElementBounds("text_1"); 240 gfx::Rect element_bounds = GetElementBounds("text_1");
248 SimulateRectTap(element_bounds - 241 SimulateRectTap(element_bounds -
249 gfx::Vector2d(element_bounds.width() / 2 + 1, 0)); 242 gfx::Vector2d(element_bounds.width() / 2 + 1, 0));
250 EXPECT_TRUE(test_listener_.form_control_element_clicked_called_); 243 EXPECT_TRUE(test_listener_.form_control_element_clicked_called_);
251 EXPECT_FALSE(test_listener_.was_focused_); 244 EXPECT_FALSE(test_listener_.was_focused_);
252 EXPECT_TRUE(text_ == test_listener_.form_control_element_clicked_); 245 EXPECT_TRUE(text_ == test_listener_.form_control_element_clicked_);
253 } 246 }
254 247
255 } // namespace autofill 248 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698