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

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

Issue 2785853002: Selection Action mode triggered like a context menu (Closed)
Patch Set: fix rebase Created 3 years, 6 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 "content/browser/renderer_host/input/stylus_text_selector.h" 5 #include "content/browser/renderer_host/input/stylus_text_selector.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 ss << "Begin(" << x0 << ", " << y0 << ", " << x1 << ", " << y1 << ")"; 43 ss << "Begin(" << x0 << ", " << y0 << ", " << x1 << ", " << y1 << ")";
44 event_log_.push_back(ss.str()); 44 event_log_.push_back(ss.str());
45 } 45 }
46 46
47 void OnStylusSelectUpdate(float x, float y) override { 47 void OnStylusSelectUpdate(float x, float y) override {
48 std::stringstream ss; 48 std::stringstream ss;
49 ss << "Update(" << x << ", " << y << ")"; 49 ss << "Update(" << x << ", " << y << ")";
50 event_log_.push_back(ss.str()); 50 event_log_.push_back(ss.str());
51 } 51 }
52 52
53 void OnStylusSelectEnd() override { event_log_.push_back("End"); } 53 void OnStylusSelectEnd(float x, float y) override {
54 event_log_.push_back("End");
55 }
54 56
55 void OnStylusSelectTap(base::TimeTicks time, float x, float y) override { 57 void OnStylusSelectTap(base::TimeTicks time, float x, float y) override {
56 event_log_.push_back("Tap"); 58 event_log_.push_back("Tap");
57 } 59 }
58 60
59 protected: 61 protected:
60 std::unique_ptr<StylusTextSelector> selector_; 62 std::unique_ptr<StylusTextSelector> selector_;
61 std::vector<std::string> event_log_; 63 std::vector<std::string> event_log_;
62 }; 64 };
63 65
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 MockMotionEvent action_up(MotionEvent::ACTION_UP, event_time, x2, y2); 409 MockMotionEvent action_up(MotionEvent::ACTION_UP, event_time, x2, y2);
408 action_up.SetToolType(0, MotionEvent::TOOL_TYPE_STYLUS); 410 action_up.SetToolType(0, MotionEvent::TOOL_TYPE_STYLUS);
409 action_up.set_button_state(0); 411 action_up.set_button_state(0);
410 EXPECT_TRUE(selector_->OnTouchEvent(action_up)); 412 EXPECT_TRUE(selector_->OnTouchEvent(action_up));
411 ASSERT_EQ(1u, event_log_.size()); 413 ASSERT_EQ(1u, event_log_.size());
412 EXPECT_STREQ("Tap", event_log_.back().c_str()); 414 EXPECT_STREQ("Tap", event_log_.back().c_str());
413 } 415 }
414 // End of tests for BUTTON_STLUS_PRIMARY case. 416 // End of tests for BUTTON_STLUS_PRIMARY case.
415 417
416 } // namespace content 418 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698