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 13 matching lines...) Expand all Loading... |
24 #include "content/public/test/browser_test_utils.h" | 24 #include "content/public/test/browser_test_utils.h" |
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/compositor/test/draw_waiter_for_test.h" | |
35 #include "ui/events/event_processor.h" | 34 #include "ui/events/event_processor.h" |
36 #include "ui/events/event_utils.h" | 35 #include "ui/events/event_utils.h" |
37 | 36 |
38 namespace content { | 37 namespace content { |
39 | 38 |
40 // This class keeps track of the RenderViewHost whose screenshot was captured. | 39 // This class keeps track of the RenderViewHost whose screenshot was captured. |
41 class ScreenshotTracker : public NavigationEntryScreenshotManager { | 40 class ScreenshotTracker : public NavigationEntryScreenshotManager { |
42 public: | 41 public: |
43 explicit ScreenshotTracker(NavigationControllerImpl* controller) | 42 explicit ScreenshotTracker(NavigationControllerImpl* controller) |
44 : NavigationEntryScreenshotManager(controller), | 43 : NavigationEntryScreenshotManager(controller), |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 return index; | 255 return index; |
257 } | 256 } |
258 | 257 |
259 protected: | 258 protected: |
260 ScreenshotTracker* screenshot_manager() { return screenshot_manager_; } | 259 ScreenshotTracker* screenshot_manager() { return screenshot_manager_; } |
261 void set_min_screenshot_interval(int interval_ms) { | 260 void set_min_screenshot_interval(int interval_ms) { |
262 screenshot_manager_->SetScreenshotInterval(interval_ms); | 261 screenshot_manager_->SetScreenshotInterval(interval_ms); |
263 } | 262 } |
264 | 263 |
265 private: | 264 private: |
266 // BrowserTestBase: | |
267 virtual void TearDownOnMainThread() OVERRIDE { | |
268 aura::Window* window = shell()->web_contents()->GetNativeView(); | |
269 ui::Compositor* compositor = window->layer()->GetCompositor(); | |
270 while (compositor->layer_animator_collection()->HasActiveAnimators()) | |
271 ui::DrawWaiterForTest::Wait(compositor); | |
272 ContentBrowserTest::TearDownOnMainThread(); | |
273 } | |
274 | |
275 ScreenshotTracker* screenshot_manager_; | 265 ScreenshotTracker* screenshot_manager_; |
276 | 266 |
277 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAuraTest); | 267 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAuraTest); |
278 }; | 268 }; |
279 | 269 |
280 // Flaky on Windows and ChromeOS: http://crbug.com/305722 | 270 // Flaky on Windows and ChromeOS: http://crbug.com/305722 |
281 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, | 271 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, |
282 DISABLED_OverscrollNavigation) { | 272 DISABLED_OverscrollNavigation) { |
283 TestOverscrollNavigation(false); | 273 TestOverscrollNavigation(false); |
284 } | 274 } |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 static_cast<WebContentsImpl*>(shell()->web_contents()); | 680 static_cast<WebContentsImpl*>(shell()->web_contents()); |
691 aura::Window* content = web_contents->GetNativeView()->parent(); | 681 aura::Window* content = web_contents->GetNativeView()->parent(); |
692 EXPECT_TRUE(web_contents->should_normally_be_visible()); | 682 EXPECT_TRUE(web_contents->should_normally_be_visible()); |
693 content->Hide(); | 683 content->Hide(); |
694 EXPECT_FALSE(web_contents->should_normally_be_visible()); | 684 EXPECT_FALSE(web_contents->should_normally_be_visible()); |
695 content->Show(); | 685 content->Show(); |
696 EXPECT_TRUE(web_contents->should_normally_be_visible()); | 686 EXPECT_TRUE(web_contents->should_normally_be_visible()); |
697 } | 687 } |
698 | 688 |
699 } // namespace content | 689 } // namespace content |
OLD | NEW |