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

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

Issue 58343006: Rename WebContentsScreenshotManager to NavigationEntryScreenshotManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove TODO. Created 7 years, 1 month 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"
11 #include "base/values.h" 11 #include "base/values.h"
12 #if defined(OS_WIN) 12 #if defined(OS_WIN)
13 #include "base/win/windows_version.h" 13 #include "base/win/windows_version.h"
14 #endif 14 #endif
15 #include "content/browser/frame_host/navigation_controller_impl.h" 15 #include "content/browser/frame_host/navigation_controller_impl.h"
16 #include "content/browser/frame_host/navigation_entry_impl.h" 16 #include "content/browser/frame_host/navigation_entry_impl.h"
17 #include "content/browser/frame_host/web_contents_screenshot_manager.h" 17 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h"
18 #include "content/browser/renderer_host/render_view_host_impl.h" 18 #include "content/browser/renderer_host/render_view_host_impl.h"
19 #include "content/browser/web_contents/web_contents_impl.h" 19 #include "content/browser/web_contents/web_contents_impl.h"
20 #include "content/public/browser/web_contents_observer.h" 20 #include "content/public/browser/web_contents_observer.h"
21 #include "content/public/browser/web_contents_view.h" 21 #include "content/public/browser/web_contents_view.h"
22 #include "content/public/common/content_switches.h" 22 #include "content/public/common/content_switches.h"
23 #include "content/public/test/browser_test_utils.h" 23 #include "content/public/test/browser_test_utils.h"
24 #include "content/public/test/test_utils.h" 24 #include "content/public/test/test_utils.h"
25 #include "content/shell/browser/shell.h" 25 #include "content/shell/browser/shell.h"
26 #include "content/test/content_browser_test.h" 26 #include "content/test/content_browser_test.h"
27 #include "content/test/content_browser_test_utils.h" 27 #include "content/test/content_browser_test_utils.h"
28 #include "ui/aura/root_window.h" 28 #include "ui/aura/root_window.h"
29 #include "ui/aura/test/event_generator.h" 29 #include "ui/aura/test/event_generator.h"
30 #include "ui/aura/window.h" 30 #include "ui/aura/window.h"
31 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 31 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
32 32
33 namespace content { 33 namespace content {
34 34
35 // This class keeps track of the RenderViewHost whose screenshot was captured. 35 // This class keeps track of the RenderViewHost whose screenshot was captured.
36 class ScreenshotTracker : public WebContentsScreenshotManager { 36 class ScreenshotTracker : public NavigationEntryScreenshotManager {
37 public: 37 public:
38 explicit ScreenshotTracker(NavigationControllerImpl* controller) 38 explicit ScreenshotTracker(NavigationControllerImpl* controller)
39 : WebContentsScreenshotManager(controller), 39 : NavigationEntryScreenshotManager(controller),
40 screenshot_taken_for_(NULL), 40 screenshot_taken_for_(NULL),
41 waiting_for_screenshots_(0) { 41 waiting_for_screenshots_(0) {
42 } 42 }
43 43
44 virtual ~ScreenshotTracker() { 44 virtual ~ScreenshotTracker() {
45 } 45 }
46 46
47 RenderViewHost* screenshot_taken_for() { return screenshot_taken_for_; } 47 RenderViewHost* screenshot_taken_for() { return screenshot_taken_for_; }
48 48
49 void Reset() { 49 void Reset() {
(...skipping 10 matching lines...) Expand all
60 return; 60 return;
61 message_loop_runner_ = new content::MessageLoopRunner; 61 message_loop_runner_ = new content::MessageLoopRunner;
62 message_loop_runner_->Run(); 62 message_loop_runner_->Run();
63 } 63 }
64 64
65 bool ScreenshotSetForEntry(NavigationEntryImpl* entry) const { 65 bool ScreenshotSetForEntry(NavigationEntryImpl* entry) const {
66 return screenshot_set_.count(entry) > 0; 66 return screenshot_set_.count(entry) > 0;
67 } 67 }
68 68
69 private: 69 private:
70 // Overridden from WebContentsScreenshotManager: 70 // Overridden from NavigationEntryScreenshotManager:
71 virtual void TakeScreenshotImpl(RenderViewHost* host, 71 virtual void TakeScreenshotImpl(RenderViewHost* host,
72 NavigationEntryImpl* entry) OVERRIDE { 72 NavigationEntryImpl* entry) OVERRIDE {
73 ++waiting_for_screenshots_; 73 ++waiting_for_screenshots_;
74 screenshot_taken_for_ = host; 74 screenshot_taken_for_ = host;
75 WebContentsScreenshotManager::TakeScreenshotImpl(host, entry); 75 NavigationEntryScreenshotManager::TakeScreenshotImpl(host, entry);
76 } 76 }
77 77
78 virtual void OnScreenshotSet(NavigationEntryImpl* entry) OVERRIDE { 78 virtual void OnScreenshotSet(NavigationEntryImpl* entry) OVERRIDE {
79 --waiting_for_screenshots_; 79 --waiting_for_screenshots_;
80 screenshot_set_[entry] = true; 80 screenshot_set_[entry] = true;
81 WebContentsScreenshotManager::OnScreenshotSet(entry); 81 NavigationEntryScreenshotManager::OnScreenshotSet(entry);
82 if (waiting_for_screenshots_ == 0 && message_loop_runner_.get()) 82 if (waiting_for_screenshots_ == 0 && message_loop_runner_.get())
83 message_loop_runner_->Quit(); 83 message_loop_runner_->Quit();
84 } 84 }
85 85
86 RenderViewHost* screenshot_taken_for_; 86 RenderViewHost* screenshot_taken_for_;
87 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; 87 scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
88 int waiting_for_screenshots_; 88 int waiting_for_screenshots_;
89 std::map<NavigationEntryImpl*, bool> screenshot_set_; 89 std::map<NavigationEntryImpl*, bool> screenshot_set_;
90 90
91 DISALLOW_COPY_AND_ASSIGN(ScreenshotTracker); 91 DISALLOW_COPY_AND_ASSIGN(ScreenshotTracker);
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 10); 662 10);
663 string16 actual_title = title_watcher.WaitAndGetTitle(); 663 string16 actual_title = title_watcher.WaitAndGetTitle();
664 EXPECT_EQ(expected_title, actual_title); 664 EXPECT_EQ(expected_title, actual_title);
665 665
666 EXPECT_EQ(2, GetCurrentIndex()); 666 EXPECT_EQ(2, GetCurrentIndex());
667 EXPECT_TRUE(controller.CanGoBack()); 667 EXPECT_TRUE(controller.CanGoBack());
668 EXPECT_FALSE(controller.CanGoForward()); 668 EXPECT_FALSE(controller.CanGoForward());
669 } 669 }
670 670
671 } // namespace content 671 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/web_contents_screenshot_manager.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698