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

Side by Side Diff: content/browser/web_contents/web_contents_view_aura_browsertest.cc

Issue 306483003: Prepare for Unified Gesture Recognizer landing in Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: All Gesture events should have timestamps. (UGR on) Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/web_contents/web_contents_view_aura.h" 5 #include "content/browser/web_contents/web_contents_view_aura.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
(...skipping 12 matching lines...) Expand all
23 #include "content/public/test/browser_test_utils.h" 23 #include "content/public/test/browser_test_utils.h"
24 #include "content/public/test/content_browser_test.h" 24 #include "content/public/test/content_browser_test.h"
25 #include "content/public/test/content_browser_test_utils.h" 25 #include "content/public/test/content_browser_test_utils.h"
26 #include "content/public/test/test_utils.h" 26 #include "content/public/test/test_utils.h"
27 #include "content/shell/browser/shell.h" 27 #include "content/shell/browser/shell.h"
28 #include "ui/aura/test/event_generator.h" 28 #include "ui/aura/test/event_generator.h"
29 #include "ui/aura/window.h" 29 #include "ui/aura/window.h"
30 #include "ui/aura/window_tree_host.h" 30 #include "ui/aura/window_tree_host.h"
31 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 31 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
32 #include "ui/events/event_processor.h" 32 #include "ui/events/event_processor.h"
33 #include "ui/events/event_utils.h"
33 34
34 namespace content { 35 namespace content {
35 36
36 // This class keeps track of the RenderViewHost whose screenshot was captured. 37 // This class keeps track of the RenderViewHost whose screenshot was captured.
37 class ScreenshotTracker : public NavigationEntryScreenshotManager { 38 class ScreenshotTracker : public NavigationEntryScreenshotManager {
38 public: 39 public:
39 explicit ScreenshotTracker(NavigationControllerImpl* controller) 40 explicit ScreenshotTracker(NavigationControllerImpl* controller)
40 : NavigationEntryScreenshotManager(controller), 41 : NavigationEntryScreenshotManager(controller),
41 screenshot_taken_for_(NULL), 42 screenshot_taken_for_(NULL),
42 waiting_for_screenshots_(0) { 43 waiting_for_screenshots_(0) {
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 EXPECT_EQ(1, GetCurrentIndex()); 314 EXPECT_EQ(1, GetCurrentIndex());
314 ExecuteSyncJSFunction(main_frame, "navigate_next()"); 315 ExecuteSyncJSFunction(main_frame, "navigate_next()");
315 EXPECT_EQ(2, GetCurrentIndex()); 316 EXPECT_EQ(2, GetCurrentIndex());
316 web_contents->GetController().GoBack(); 317 web_contents->GetController().GoBack();
317 EXPECT_EQ(1, GetCurrentIndex()); 318 EXPECT_EQ(1, GetCurrentIndex());
318 319
319 aura::Window* content = web_contents->GetContentNativeView(); 320 aura::Window* content = web_contents->GetContentNativeView();
320 ui::EventProcessor* dispatcher = content->GetHost()->event_processor(); 321 ui::EventProcessor* dispatcher = content->GetHost()->event_processor();
321 gfx::Rect bounds = content->GetBoundsInRootWindow(); 322 gfx::Rect bounds = content->GetBoundsInRootWindow();
322 323
323 base::TimeDelta timestamp; 324 base::TimeDelta timestamp = ui::EventTimeForNow();
324 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, 325 ui::TouchEvent press(ui::ET_TOUCH_PRESSED,
325 gfx::Point(bounds.x() + bounds.width() / 2, bounds.y() + 5), 326 gfx::Point(bounds.x() + bounds.width() / 2, bounds.y() + 5),
326 0, timestamp); 327 0, timestamp);
327 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press); 328 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press);
328 ASSERT_FALSE(details.dispatcher_destroyed); 329 ASSERT_FALSE(details.dispatcher_destroyed);
329 EXPECT_EQ(1, GetCurrentIndex()); 330 EXPECT_EQ(1, GetCurrentIndex());
330 331
331 timestamp += base::TimeDelta::FromMilliseconds(10); 332 timestamp += base::TimeDelta::FromMilliseconds(10);
332 ui::TouchEvent move1(ui::ET_TOUCH_MOVED, 333 ui::TouchEvent move1(ui::ET_TOUCH_MOVED,
333 gfx::Point(bounds.right() - 10, bounds.y() + 5), 334 gfx::Point(bounds.right() - 10, bounds.y() + 5),
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 static_cast<WebContentsImpl*>(shell()->web_contents()); 684 static_cast<WebContentsImpl*>(shell()->web_contents());
684 aura::Window* content = web_contents->GetNativeView()->parent(); 685 aura::Window* content = web_contents->GetNativeView()->parent();
685 EXPECT_TRUE(web_contents->should_normally_be_visible()); 686 EXPECT_TRUE(web_contents->should_normally_be_visible());
686 content->Hide(); 687 content->Hide();
687 EXPECT_FALSE(web_contents->should_normally_be_visible()); 688 EXPECT_FALSE(web_contents->should_normally_be_visible());
688 content->Show(); 689 content->Show();
689 EXPECT_TRUE(web_contents->should_normally_be_visible()); 690 EXPECT_TRUE(web_contents->should_normally_be_visible());
690 } 691 }
691 692
692 } // namespace content 693 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698