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

Side by Side Diff: ui/events/event_processor_unittest.cc

Issue 1411833006: Refactoring to make adding ink drop animations easier (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor ink drop animations (nits in ui/views/ Created 5 years 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 | « ui/aura/window.cc ('k') | ui/events/event_target.h » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 <vector> 5 #include <vector>
6 6
7 #include "base/macros.h"
7 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/events/event.h" 9 #include "ui/events/event.h"
9 #include "ui/events/event_target_iterator.h" 10 #include "ui/events/event_target_iterator.h"
10 #include "ui/events/event_targeter.h" 11 #include "ui/events/event_targeter.h"
11 #include "ui/events/event_utils.h" 12 #include "ui/events/event_utils.h"
12 #include "ui/events/test/events_test_utils.h" 13 #include "ui/events/test/events_test_utils.h"
13 #include "ui/events/test/test_event_handler.h" 14 #include "ui/events/test/test_event_handler.h"
14 #include "ui/events/test/test_event_processor.h" 15 #include "ui/events/test/test_event_processor.h"
15 #include "ui/events/test/test_event_target.h" 16 #include "ui/events/test/test_event_target.h"
16 #include "ui/events/test/test_event_targeter.h" 17 #include "ui/events/test/test_event_targeter.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 second_root->AddChild(second_child.Pass()); 133 second_root->AddChild(second_child.Pass());
133 134
134 // Define a second event processor which owns the second root. 135 // Define a second event processor which owns the second root.
135 scoped_ptr<TestEventProcessor> second_processor(new TestEventProcessor()); 136 scoped_ptr<TestEventProcessor> second_processor(new TestEventProcessor());
136 second_processor->SetRoot(second_root_scoped.Pass()); 137 second_processor->SetRoot(second_root_scoped.Pass());
137 138
138 // Indicate that an event which is dispatched to the child target owned by the 139 // Indicate that an event which is dispatched to the child target owned by the
139 // first event processor should be handled by |target_handler| instead. 140 // first event processor should be handled by |target_handler| instead.
140 scoped_ptr<TestEventHandler> target_handler( 141 scoped_ptr<TestEventHandler> target_handler(
141 new ReDispatchEventHandler(second_processor.get(), root()->child_at(0))); 142 new ReDispatchEventHandler(second_processor.get(), root()->child_at(0)));
142 root()->child_at(0)->set_target_handler(target_handler.get()); 143 ignore_result(root()->child_at(0)->SetTargetHandler(target_handler.get()));
143 144
144 // Dispatch a mouse event to the tree of event targets owned by the first 145 // Dispatch a mouse event to the tree of event targets owned by the first
145 // event processor, checking in ReDispatchEventHandler that the phase and 146 // event processor, checking in ReDispatchEventHandler that the phase and
146 // target information of the event is correct. 147 // target information of the event is correct.
147 MouseEvent mouse(ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10), 148 MouseEvent mouse(ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10),
148 EventTimeForNow(), EF_NONE, EF_NONE); 149 EventTimeForNow(), EF_NONE, EF_NONE);
149 DispatchEvent(&mouse); 150 DispatchEvent(&mouse);
150 151
151 // Verify also that |mouse| was seen by the child nodes contained in both 152 // Verify also that |mouse| was seen by the child nodes contained in both
152 // event processors and that the event was not handled. 153 // event processors and that the event was not handled.
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 DispatchEvent(&mouse); 363 DispatchEvent(&mouse);
363 364
364 std::string expected[] = { "PreR", "PreC", "PreG", "G", "PostG", "PostC", 365 std::string expected[] = { "PreR", "PreC", "PreG", "G", "PostG", "PostC",
365 "PostR", "PreR", "PreC", "C", "PostC", "PostR", "PreR", "R", "PostR" }; 366 "PostR", "PreR", "PreC", "C", "PostC", "PostR", "PreR", "R", "PostR" };
366 EXPECT_EQ(std::vector<std::string>( 367 EXPECT_EQ(std::vector<std::string>(
367 expected, expected + arraysize(expected)), recorder); 368 expected, expected + arraysize(expected)), recorder);
368 } 369 }
369 370
370 } // namespace test 371 } // namespace test
371 } // namespace ui 372 } // namespace ui
OLDNEW
« no previous file with comments | « ui/aura/window.cc ('k') | ui/events/event_target.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698