OLD | NEW |
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 14 matching lines...) Expand all Loading... |
25 #include "content/public/test/content_browser_test.h" | 25 #include "content/public/test/content_browser_test.h" |
26 #include "content/public/test/content_browser_test_utils.h" | 26 #include "content/public/test/content_browser_test_utils.h" |
27 #include "content/public/test/test_renderer_host.h" | 27 #include "content/public/test/test_renderer_host.h" |
28 #include "content/public/test/test_utils.h" | 28 #include "content/public/test/test_utils.h" |
29 #include "content/shell/browser/shell.h" | 29 #include "content/shell/browser/shell.h" |
30 #include "ui/aura/test/event_generator.h" | 30 #include "ui/aura/test/event_generator.h" |
31 #include "ui/aura/window.h" | 31 #include "ui/aura/window.h" |
32 #include "ui/aura/window_tree_host.h" | 32 #include "ui/aura/window_tree_host.h" |
33 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 33 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
34 #include "ui/events/event_processor.h" | 34 #include "ui/events/event_processor.h" |
| 35 #include "ui/events/event_utils.h" |
35 | 36 |
36 namespace content { | 37 namespace content { |
37 | 38 |
38 // This class keeps track of the RenderViewHost whose screenshot was captured. | 39 // This class keeps track of the RenderViewHost whose screenshot was captured. |
39 class ScreenshotTracker : public NavigationEntryScreenshotManager { | 40 class ScreenshotTracker : public NavigationEntryScreenshotManager { |
40 public: | 41 public: |
41 explicit ScreenshotTracker(NavigationControllerImpl* controller) | 42 explicit ScreenshotTracker(NavigationControllerImpl* controller) |
42 : NavigationEntryScreenshotManager(controller), | 43 : NavigationEntryScreenshotManager(controller), |
43 screenshot_taken_for_(NULL), | 44 screenshot_taken_for_(NULL), |
44 waiting_for_screenshots_(0) { | 45 waiting_for_screenshots_(0) { |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 EXPECT_EQ(1, GetCurrentIndex()); | 313 EXPECT_EQ(1, GetCurrentIndex()); |
313 ExecuteSyncJSFunction(main_frame, "navigate_next()"); | 314 ExecuteSyncJSFunction(main_frame, "navigate_next()"); |
314 EXPECT_EQ(2, GetCurrentIndex()); | 315 EXPECT_EQ(2, GetCurrentIndex()); |
315 web_contents->GetController().GoBack(); | 316 web_contents->GetController().GoBack(); |
316 EXPECT_EQ(1, GetCurrentIndex()); | 317 EXPECT_EQ(1, GetCurrentIndex()); |
317 | 318 |
318 aura::Window* content = web_contents->GetContentNativeView(); | 319 aura::Window* content = web_contents->GetContentNativeView(); |
319 ui::EventProcessor* dispatcher = content->GetHost()->event_processor(); | 320 ui::EventProcessor* dispatcher = content->GetHost()->event_processor(); |
320 gfx::Rect bounds = content->GetBoundsInRootWindow(); | 321 gfx::Rect bounds = content->GetBoundsInRootWindow(); |
321 | 322 |
322 base::TimeDelta timestamp; | 323 base::TimeDelta timestamp = ui::EventTimeForNow(); |
323 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, | 324 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, |
324 gfx::Point(bounds.x() + bounds.width() / 2, bounds.y() + 5), | 325 gfx::Point(bounds.x() + bounds.width() / 2, bounds.y() + 5), |
325 0, timestamp); | 326 0, timestamp); |
326 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press); | 327 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press); |
327 ASSERT_FALSE(details.dispatcher_destroyed); | 328 ASSERT_FALSE(details.dispatcher_destroyed); |
328 EXPECT_EQ(1, GetCurrentIndex()); | 329 EXPECT_EQ(1, GetCurrentIndex()); |
329 | 330 |
330 timestamp += base::TimeDelta::FromMilliseconds(10); | 331 timestamp += base::TimeDelta::FromMilliseconds(10); |
331 ui::TouchEvent move1(ui::ET_TOUCH_MOVED, | 332 ui::TouchEvent move1(ui::ET_TOUCH_MOVED, |
332 gfx::Point(bounds.right() - 10, bounds.y() + 5), | 333 gfx::Point(bounds.right() - 10, bounds.y() + 5), |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 static_cast<WebContentsImpl*>(shell()->web_contents()); | 680 static_cast<WebContentsImpl*>(shell()->web_contents()); |
680 aura::Window* content = web_contents->GetNativeView()->parent(); | 681 aura::Window* content = web_contents->GetNativeView()->parent(); |
681 EXPECT_TRUE(web_contents->should_normally_be_visible()); | 682 EXPECT_TRUE(web_contents->should_normally_be_visible()); |
682 content->Hide(); | 683 content->Hide(); |
683 EXPECT_FALSE(web_contents->should_normally_be_visible()); | 684 EXPECT_FALSE(web_contents->should_normally_be_visible()); |
684 content->Show(); | 685 content->Show(); |
685 EXPECT_TRUE(web_contents->should_normally_be_visible()); | 686 EXPECT_TRUE(web_contents->should_normally_be_visible()); |
686 } | 687 } |
687 | 688 |
688 } // namespace content | 689 } // namespace content |
OLD | NEW |