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

Side by Side Diff: content/browser/renderer_host/input/gesture_text_selector_unittest.cc

Issue 667943003: Standardize usage of virtual/override/final in content/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/browser/renderer_host/input/gesture_text_selector.h" 10 #include "content/browser/renderer_host/input/gesture_text_selector.h"
(...skipping 19 matching lines...) Expand all
30 selector_.reset(new GestureTextSelector(this)); 30 selector_.reset(new GestureTextSelector(this));
31 event_log_.clear(); 31 event_log_.clear();
32 } 32 }
33 33
34 virtual void TearDown() override { 34 virtual void TearDown() override {
35 selector_.reset(); 35 selector_.reset();
36 event_log_.clear(); 36 event_log_.clear();
37 } 37 }
38 38
39 // GestureTextSelectorClient implementation. 39 // GestureTextSelectorClient implementation.
40 virtual void ShowSelectionHandlesAutomatically() override { 40 void ShowSelectionHandlesAutomatically() override {
41 event_log_.push_back("Show"); 41 event_log_.push_back("Show");
42 } 42 }
43 43
44 virtual void SelectRange(float x1, float y1, float x2, float y2) override { 44 void SelectRange(float x1, float y1, float x2, float y2) override {
45 std::stringstream ss; 45 std::stringstream ss;
46 ss << "SelectRange(" << x1 << ", " << y1 << ", " << x2 << ", " << y2 << ")"; 46 ss << "SelectRange(" << x1 << ", " << y1 << ", " << x2 << ", " << y2 << ")";
47 event_log_.push_back(ss.str()); 47 event_log_.push_back(ss.str());
48 } 48 }
49 49
50 virtual void LongPress(base::TimeTicks time, float x, float y) override { 50 void LongPress(base::TimeTicks time, float x, float y) override {
51 event_log_.push_back("LongPress"); 51 event_log_.push_back("LongPress");
52 } 52 }
53 53
54 protected: 54 protected:
55 scoped_ptr<GestureTextSelector> selector_; 55 scoped_ptr<GestureTextSelector> selector_;
56 std::vector<std::string> event_log_; 56 std::vector<std::string> event_log_;
57 }; 57 };
58 58
59 TEST_F(GestureTextSelectorTest, ShouldStartTextSelection) { 59 TEST_F(GestureTextSelectorTest, ShouldStartTextSelection) {
60 base::TimeTicks event_time = base::TimeTicks::Now(); 60 base::TimeTicks event_time = base::TimeTicks::Now();
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 event_time += base::TimeDelta::FromMilliseconds(1); 214 event_time += base::TimeDelta::FromMilliseconds(1);
215 MockMotionEvent action_up(MotionEvent::ACTION_UP, event_time, x2, y2); 215 MockMotionEvent action_up(MotionEvent::ACTION_UP, event_time, x2, y2);
216 action_up.SetToolType(0, MotionEvent::TOOL_TYPE_STYLUS); 216 action_up.SetToolType(0, MotionEvent::TOOL_TYPE_STYLUS);
217 action_up.set_button_state(0); 217 action_up.set_button_state(0);
218 EXPECT_TRUE(selector_->OnTouchEvent(action_up)); 218 EXPECT_TRUE(selector_->OnTouchEvent(action_up));
219 ASSERT_EQ(1u, event_log_.size()); 219 ASSERT_EQ(1u, event_log_.size());
220 EXPECT_STREQ("LongPress", event_log_.back().c_str()); 220 EXPECT_STREQ("LongPress", event_log_.back().c_str());
221 } 221 }
222 222
223 } // namespace content 223 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/gesture_text_selector.h ('k') | content/browser/renderer_host/input/input_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698