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

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

Issue 630603003: Replacing the OVERRIDE with override in chrome/renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased the patch Created 6 years, 2 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 (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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "components/autofill/content/renderer/page_click_listener.h" 6 #include "components/autofill/content/renderer/page_click_listener.h"
7 #include "components/autofill/content/renderer/page_click_tracker.h" 7 #include "components/autofill/content/renderer/page_click_tracker.h"
8 #include "content/public/renderer/render_view.h" 8 #include "content/public/renderer/render_view.h"
9 #include "content/public/test/render_view_test.h" 9 #include "content/public/test/render_view_test.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "third_party/WebKit/public/web/WebDocument.h" 11 #include "third_party/WebKit/public/web/WebDocument.h"
12 #include "third_party/WebKit/public/web/WebInputElement.h" 12 #include "third_party/WebKit/public/web/WebInputElement.h"
13 #include "third_party/WebKit/public/web/WebTextAreaElement.h" 13 #include "third_party/WebKit/public/web/WebTextAreaElement.h"
14 #include "third_party/WebKit/public/web/WebView.h" 14 #include "third_party/WebKit/public/web/WebView.h"
15 #include "third_party/WebKit/public/platform/WebSize.h" 15 #include "third_party/WebKit/public/platform/WebSize.h"
16 #include "ui/events/keycodes/keyboard_codes.h" 16 #include "ui/events/keycodes/keyboard_codes.h"
17 17
18 namespace autofill { 18 namespace autofill {
19 19
20 class TestPageClickListener : public PageClickListener { 20 class TestPageClickListener : public PageClickListener {
21 public: 21 public:
22 TestPageClickListener() 22 TestPageClickListener()
23 : form_control_element_clicked_called_(false), 23 : form_control_element_clicked_called_(false),
24 was_focused_(false) {} 24 was_focused_(false) {}
25 25
26 virtual void FormControlElementClicked( 26 virtual void FormControlElementClicked(
27 const blink::WebFormControlElement& element, 27 const blink::WebFormControlElement& element,
28 bool was_focused) OVERRIDE { 28 bool was_focused) override {
29 form_control_element_clicked_called_ = true; 29 form_control_element_clicked_called_ = true;
30 form_control_element_clicked_ = element; 30 form_control_element_clicked_ = element;
31 was_focused_ = was_focused; 31 was_focused_ = was_focused;
32 } 32 }
33 33
34 void ClearResults() { 34 void ClearResults() {
35 form_control_element_clicked_called_ = false; 35 form_control_element_clicked_called_ = false;
36 form_control_element_clicked_.reset(); 36 form_control_element_clicked_.reset();
37 was_focused_ = false; 37 was_focused_ = false;
38 } 38 }
39 39
40 bool form_control_element_clicked_called_; 40 bool form_control_element_clicked_called_;
41 blink::WebFormControlElement form_control_element_clicked_; 41 blink::WebFormControlElement form_control_element_clicked_;
42 bool was_focused_; 42 bool was_focused_;
43 }; 43 };
44 44
45 class PageClickTrackerTest : public content::RenderViewTest { 45 class PageClickTrackerTest : public content::RenderViewTest {
46 protected: 46 protected:
47 virtual void SetUp() OVERRIDE { 47 virtual void SetUp() override {
48 content::RenderViewTest::SetUp(); 48 content::RenderViewTest::SetUp();
49 49
50 // RenderView creates PageClickTracker but it doesn't keep it around. 50 // RenderView creates PageClickTracker but it doesn't keep it around.
51 // Rather than make it do so for the test, we create a new object. 51 // Rather than make it do so for the test, we create a new object.
52 page_click_tracker_.reset(new PageClickTracker(view_, &test_listener_)); 52 page_click_tracker_.reset(new PageClickTracker(view_, &test_listener_));
53 53
54 LoadHTML("<form>" 54 LoadHTML("<form>"
55 " <input type='text' id='text_1'></input><br>" 55 " <input type='text' id='text_1'></input><br>"
56 " <input type='text' id='text_2'></input><br>" 56 " <input type='text' id='text_2'></input><br>"
57 " <textarea id='textarea_1'></textarea><br>" 57 " <textarea id='textarea_1'></textarea><br>"
58 " <textarea id='textarea_2'></textarea><br>" 58 " <textarea id='textarea_2'></textarea><br>"
59 " <input type='button' id='button'></input><br>" 59 " <input type='button' id='button'></input><br>"
60 "</form>"); 60 "</form>");
61 GetWebWidget()->resize(blink::WebSize(500, 500)); 61 GetWebWidget()->resize(blink::WebSize(500, 500));
62 GetWebWidget()->setFocus(true); 62 GetWebWidget()->setFocus(true);
63 blink::WebDocument document = view_->GetWebView()->mainFrame()->document(); 63 blink::WebDocument document = view_->GetWebView()->mainFrame()->document();
64 text_ = document.getElementById("text_1"); 64 text_ = document.getElementById("text_1");
65 textarea_ = document.getElementById("textarea_1"); 65 textarea_ = document.getElementById("textarea_1");
66 ASSERT_FALSE(text_.isNull()); 66 ASSERT_FALSE(text_.isNull());
67 ASSERT_FALSE(textarea_.isNull()); 67 ASSERT_FALSE(textarea_.isNull());
68 } 68 }
69 69
70 virtual void TearDown() OVERRIDE { 70 virtual void TearDown() override {
71 text_.reset(); 71 text_.reset();
72 textarea_.reset(); 72 textarea_.reset();
73 test_listener_.ClearResults(); 73 test_listener_.ClearResults();
74 page_click_tracker_.reset(); 74 page_click_tracker_.reset();
75 content::RenderViewTest::TearDown(); 75 content::RenderViewTest::TearDown();
76 } 76 }
77 77
78 // Simulates a click on the given element and then waits for the stack 78 // Simulates a click on the given element and then waits for the stack
79 // to unwind. 79 // to unwind.
80 void SendElementClick(const std::string& element_id) { 80 void SendElementClick(const std::string& element_id) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 EXPECT_TRUE(test_listener_.was_focused_); 143 EXPECT_TRUE(test_listener_.was_focused_);
144 EXPECT_TRUE(textarea_ == test_listener_.form_control_element_clicked_); 144 EXPECT_TRUE(textarea_ == test_listener_.form_control_element_clicked_);
145 test_listener_.ClearResults(); 145 test_listener_.ClearResults();
146 146
147 // Click the button, no notification should happen (this is not a text-input). 147 // Click the button, no notification should happen (this is not a text-input).
148 SendElementClick("button"); 148 SendElementClick("button");
149 EXPECT_FALSE(test_listener_.form_control_element_clicked_called_); 149 EXPECT_FALSE(test_listener_.form_control_element_clicked_called_);
150 } 150 }
151 151
152 } // namespace autofill 152 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/renderer/autofill/autofill_renderer_browsertest.cc ('k') | chrome/renderer/benchmarking_extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698