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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 2652343003: Replace source pointer in cc::CopyOutputRequest with a base::UnguessableToken (Closed)
Patch Set: c Created 3 years, 10 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
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/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <tuple> 10 #include <tuple>
(...skipping 25 matching lines...) Expand all
36 #include "content/browser/renderer_host/delegated_frame_host.h" 36 #include "content/browser/renderer_host/delegated_frame_host.h"
37 #include "content/browser/renderer_host/delegated_frame_host_client_aura.h" 37 #include "content/browser/renderer_host/delegated_frame_host_client_aura.h"
38 #include "content/browser/renderer_host/input/input_router.h" 38 #include "content/browser/renderer_host/input/input_router.h"
39 #include "content/browser/renderer_host/input/mouse_wheel_event_queue.h" 39 #include "content/browser/renderer_host/input/mouse_wheel_event_queue.h"
40 #include "content/browser/renderer_host/overscroll_controller.h" 40 #include "content/browser/renderer_host/overscroll_controller.h"
41 #include "content/browser/renderer_host/overscroll_controller_delegate.h" 41 #include "content/browser/renderer_host/overscroll_controller_delegate.h"
42 #include "content/browser/renderer_host/render_view_host_factory.h" 42 #include "content/browser/renderer_host/render_view_host_factory.h"
43 #include "content/browser/renderer_host/render_widget_host_delegate.h" 43 #include "content/browser/renderer_host/render_widget_host_delegate.h"
44 #include "content/browser/renderer_host/render_widget_host_impl.h" 44 #include "content/browser/renderer_host/render_widget_host_impl.h"
45 #include "content/browser/renderer_host/render_widget_host_view_event_handler.h" 45 #include "content/browser/renderer_host/render_widget_host_view_event_handler.h"
46 #include "content/browser/renderer_host/render_widget_host_view_frame_subscriber .h"
46 #include "content/browser/renderer_host/resize_lock.h" 47 #include "content/browser/renderer_host/resize_lock.h"
47 #include "content/browser/renderer_host/text_input_manager.h" 48 #include "content/browser/renderer_host/text_input_manager.h"
48 #include "content/browser/web_contents/web_contents_view_aura.h" 49 #include "content/browser/web_contents/web_contents_view_aura.h"
49 #include "content/common/host_shared_bitmap_manager.h" 50 #include "content/common/host_shared_bitmap_manager.h"
50 #include "content/common/input/synthetic_web_input_event_builders.h" 51 #include "content/common/input/synthetic_web_input_event_builders.h"
51 #include "content/common/input_messages.h" 52 #include "content/common/input_messages.h"
52 #include "content/common/text_input_state.h" 53 #include "content/common/text_input_state.h"
53 #include "content/common/view_messages.h" 54 #include "content/common/view_messages.h"
54 #include "content/public/browser/render_widget_host_view.h" 55 #include "content/public/browser/render_widget_host_view.h"
55 #include "content/public/browser/render_widget_host_view_frame_subscriber.h"
56 #include "content/public/browser/web_contents_view_delegate.h" 56 #include "content/public/browser/web_contents_view_delegate.h"
57 #include "content/public/common/context_menu_params.h" 57 #include "content/public/common/context_menu_params.h"
58 #include "content/public/test/mock_render_process_host.h" 58 #include "content/public/test/mock_render_process_host.h"
59 #include "content/public/test/test_browser_context.h" 59 #include "content/public/test/test_browser_context.h"
60 #include "content/test/test_render_view_host.h" 60 #include "content/test/test_render_view_host.h"
61 #include "content/test/test_web_contents.h" 61 #include "content/test/test_web_contents.h"
62 #include "ipc/ipc_message.h" 62 #include "ipc/ipc_message.h"
63 #include "ipc/ipc_test_sink.h" 63 #include "ipc/ipc_test_sink.h"
64 #include "media/base/video_frame.h" 64 #include "media/base/video_frame.h"
65 #include "testing/gmock/include/gmock/gmock.h" 65 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override {} 262 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override {}
263 263
264 void OnSurfaceDamaged(const cc::SurfaceId& id, bool* changed) override { 264 void OnSurfaceDamaged(const cc::SurfaceId& id, bool* changed) override {
265 *changed = true; 265 *changed = true;
266 } 266 }
267 }; 267 };
268 268
269 class FakeFrameSubscriber : public RenderWidgetHostViewFrameSubscriber { 269 class FakeFrameSubscriber : public RenderWidgetHostViewFrameSubscriber {
270 public: 270 public:
271 FakeFrameSubscriber(gfx::Size size, base::Callback<void(bool)> callback) 271 FakeFrameSubscriber(gfx::Size size, base::Callback<void(bool)> callback)
272 : size_(size), callback_(callback), should_capture_(true) {} 272 : size_(size),
273 callback_(callback),
274 should_capture_(true),
275 source_id_for_copy_request_(base::UnguessableToken::Create()) {}
273 276
274 bool ShouldCaptureFrame(const gfx::Rect& damage_rect, 277 bool ShouldCaptureFrame(const gfx::Rect& damage_rect,
275 base::TimeTicks present_time, 278 base::TimeTicks present_time,
276 scoped_refptr<media::VideoFrame>* storage, 279 scoped_refptr<media::VideoFrame>* storage,
277 DeliverFrameCallback* callback) override { 280 DeliverFrameCallback* callback) override {
278 if (!should_capture_) 281 if (!should_capture_)
279 return false; 282 return false;
280 last_present_time_ = present_time; 283 last_present_time_ = present_time;
281 *storage = media::VideoFrame::CreateFrame(media::PIXEL_FORMAT_YV12, size_, 284 *storage = media::VideoFrame::CreateFrame(media::PIXEL_FORMAT_YV12, size_,
282 gfx::Rect(size_), size_, 285 gfx::Rect(size_), size_,
283 base::TimeDelta()); 286 base::TimeDelta());
284 *callback = base::Bind(&FakeFrameSubscriber::CallbackMethod, callback_); 287 *callback = base::Bind(&FakeFrameSubscriber::CallbackMethod, callback_);
285 return true; 288 return true;
286 } 289 }
287 290
291 const base::UnguessableToken& GetSourceIdForCopyRequest() override {
292 return source_id_for_copy_request_;
293 }
294
288 base::TimeTicks last_present_time() const { return last_present_time_; } 295 base::TimeTicks last_present_time() const { return last_present_time_; }
289 296
290 void set_should_capture(bool should_capture) { 297 void set_should_capture(bool should_capture) {
291 should_capture_ = should_capture; 298 should_capture_ = should_capture;
292 } 299 }
293 300
294 static void CallbackMethod(base::Callback<void(bool)> callback, 301 static void CallbackMethod(base::Callback<void(bool)> callback,
295 base::TimeTicks present_time, 302 base::TimeTicks present_time,
296 const gfx::Rect& region_in_frame, 303 const gfx::Rect& region_in_frame,
297 bool success) { 304 bool success) {
298 callback.Run(success); 305 callback.Run(success);
299 } 306 }
300 307
301 private: 308 private:
302 gfx::Size size_; 309 gfx::Size size_;
303 base::Callback<void(bool)> callback_; 310 base::Callback<void(bool)> callback_;
304 base::TimeTicks last_present_time_; 311 base::TimeTicks last_present_time_;
305 bool should_capture_; 312 bool should_capture_;
313 base::UnguessableToken source_id_for_copy_request_;
306 }; 314 };
307 315
308 class FakeWindowEventDispatcher : public aura::WindowEventDispatcher { 316 class FakeWindowEventDispatcher : public aura::WindowEventDispatcher {
309 public: 317 public:
310 FakeWindowEventDispatcher(aura::WindowTreeHost* host) 318 FakeWindowEventDispatcher(aura::WindowTreeHost* host)
311 : WindowEventDispatcher(host), 319 : WindowEventDispatcher(host),
312 processed_touch_event_count_(0) {} 320 processed_touch_event_count_(0) {}
313 321
314 void ProcessedTouchEvent(uint32_t unique_event_id, 322 void ProcessedTouchEvent(uint32_t unique_event_id,
315 aura::Window* window, 323 aura::Window* window,
(...skipping 4443 matching lines...) Expand 10 before | Expand all | Expand 10 after
4759 // There is no composition in the beginning. 4767 // There is no composition in the beginning.
4760 EXPECT_FALSE(has_composition_text()); 4768 EXPECT_FALSE(has_composition_text());
4761 SetHasCompositionTextToTrue(); 4769 SetHasCompositionTextToTrue();
4762 view->ImeCancelComposition(); 4770 view->ImeCancelComposition();
4763 // The composition must have been canceled. 4771 // The composition must have been canceled.
4764 EXPECT_FALSE(has_composition_text()); 4772 EXPECT_FALSE(has_composition_text());
4765 } 4773 }
4766 } 4774 }
4767 4775
4768 } // namespace content 4776 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698