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/browser/chromeos/events/keyboard_driven_event_rewriter_unittest.cc

Issue 404203003: Distinguish between keystroke and character events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IsCharFromNative() for Mac build 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "chrome/browser/chromeos/events/keyboard_driven_event_rewriter.h" 10 #include "chrome/browser/chromeos/events/keyboard_driven_event_rewriter.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/events/event.h" 12 #include "ui/events/event.h"
13 13
14 namespace chromeos { 14 namespace chromeos {
15 15
16 class KeyboardDrivenEventRewriterTest : public testing::Test { 16 class KeyboardDrivenEventRewriterTest : public testing::Test {
17 public: 17 public:
18 KeyboardDrivenEventRewriterTest() {} 18 KeyboardDrivenEventRewriterTest() {}
19 19
20 virtual ~KeyboardDrivenEventRewriterTest() {} 20 virtual ~KeyboardDrivenEventRewriterTest() {}
21 21
22 protected: 22 protected:
23 std::string GetRewrittenEventAsString(ui::KeyboardCode ui_keycode, 23 std::string GetRewrittenEventAsString(ui::KeyboardCode ui_keycode,
24 int ui_flags, 24 int ui_flags,
25 ui::EventType ui_type) { 25 ui::EventType ui_type) {
26 ui::KeyEvent keyevent(ui_type, ui_keycode, ui_flags, false); 26 ui::KeyEvent keyevent(ui_type, ui_keycode, ui_flags);
27 scoped_ptr<ui::Event> rewritten_event; 27 scoped_ptr<ui::Event> rewritten_event;
28 ui::EventRewriteStatus status = 28 ui::EventRewriteStatus status =
29 rewriter_.RewriteForTesting(keyevent, &rewritten_event); 29 rewriter_.RewriteForTesting(keyevent, &rewritten_event);
30 return base::StringPrintf( 30 return base::StringPrintf(
31 "ui_flags=%d status=%d", 31 "ui_flags=%d status=%d",
32 rewritten_event ? rewritten_event->flags() : keyevent.flags(), 32 rewritten_event ? rewritten_event->flags() : keyevent.flags(),
33 status); 33 status);
34 } 34 }
35 35
36 std::string GetExpectedResultAsString(int ui_flags, 36 std::string GetExpectedResultAsString(int ui_flags,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 EXPECT_EQ(GetExpectedResultAsString(ui::EF_NONE, 106 EXPECT_EQ(GetExpectedResultAsString(ui::EF_NONE,
107 ui::EVENT_REWRITE_REWRITTEN), 107 ui::EVENT_REWRITE_REWRITTEN),
108 GetRewrittenEventAsString(kTests[i].ui_keycode, 108 GetRewrittenEventAsString(kTests[i].ui_keycode,
109 kTests[i].ui_flags, 109 kTests[i].ui_flags,
110 ui::ET_KEY_PRESSED)) 110 ui::ET_KEY_PRESSED))
111 << "Test case " << i; 111 << "Test case " << i;
112 } 112 }
113 } 113 }
114 114
115 } // namespace chromeos 115 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/events/event_rewriter_unittest.cc ('k') | chrome/browser/chromeos/input_method/input_method_engine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698