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

Side by Side Diff: content/public/test/browser_test_utils.h

Issue 1631963002: Plumb firing passive event listeners. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_wheel_passive_listeners_2a
Patch Set: Fix creis's comments Created 4 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
« no previous file with comments | « content/content_tests.gypi ('k') | content/public/test/browser_test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ 5 #ifndef CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_
6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ 6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/files/scoped_temp_dir.h" 14 #include "base/files/scoped_temp_dir.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/process/process.h" 17 #include "base/process/process.h"
18 #include "base/strings/string16.h" 18 #include "base/strings/string16.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "cc/output/compositor_frame.h"
20 #include "content/public/browser/browser_message_filter.h" 21 #include "content/public/browser/browser_message_filter.h"
21 #include "content/public/browser/notification_observer.h" 22 #include "content/public/browser/notification_observer.h"
22 #include "content/public/browser/notification_registrar.h" 23 #include "content/public/browser/notification_registrar.h"
23 #include "content/public/browser/render_process_host_observer.h" 24 #include "content/public/browser/render_process_host_observer.h"
24 #include "content/public/browser/web_contents_observer.h" 25 #include "content/public/browser/web_contents_observer.h"
25 #include "content/public/common/page_type.h" 26 #include "content/public/common/page_type.h"
26 #include "third_party/WebKit/public/web/WebInputEvent.h" 27 #include "third_party/WebKit/public/web/WebInputEvent.h"
27 #include "ui/events/keycodes/keyboard_codes.h" 28 #include "ui/events/keycodes/keyboard_codes.h"
28 #include "url/gurl.h" 29 #include "url/gurl.h"
29 30
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 class FrameWatcher : public BrowserMessageFilter { 419 class FrameWatcher : public BrowserMessageFilter {
419 public: 420 public:
420 FrameWatcher(); 421 FrameWatcher();
421 422
422 // Listen for new frames from the |web_contents| renderer process. 423 // Listen for new frames from the |web_contents| renderer process.
423 void AttachTo(WebContents* web_contents); 424 void AttachTo(WebContents* web_contents);
424 425
425 // Wait for |frames_to_wait| swap mesages from the compositor. 426 // Wait for |frames_to_wait| swap mesages from the compositor.
426 void WaitFrames(int frames_to_wait); 427 void WaitFrames(int frames_to_wait);
427 428
429 // Return the meta data received in the last compositor
430 // swap frame.
431 const cc::CompositorFrameMetadata& LastMetadata();
432
428 private: 433 private:
429 ~FrameWatcher() override; 434 ~FrameWatcher() override;
430 435
431 // Overridden BrowserMessageFilter methods. 436 // Overridden BrowserMessageFilter methods.
432 bool OnMessageReceived(const IPC::Message& message) override; 437 bool OnMessageReceived(const IPC::Message& message) override;
433 438
434 void ReceivedFrameSwap(); 439 void ReceivedFrameSwap(cc::CompositorFrameMetadata meta_data);
435 440
436 int frames_to_wait_; 441 int frames_to_wait_;
437 base::Closure quit_; 442 base::Closure quit_;
443 cc::CompositorFrameMetadata last_metadata_;
438 444
439 DISALLOW_COPY_AND_ASSIGN(FrameWatcher); 445 DISALLOW_COPY_AND_ASSIGN(FrameWatcher);
440 }; 446 };
441 447
442 // This class is intended to synchronize the renderer main thread, renderer impl 448 // This class is intended to synchronize the renderer main thread, renderer impl
443 // thread and the browser main thread. 449 // thread and the browser main thread.
444 class MainThreadFrameObserver : public IPC::Listener { 450 class MainThreadFrameObserver : public IPC::Listener {
445 public: 451 public:
446 explicit MainThreadFrameObserver(RenderWidgetHost* render_widget_host); 452 explicit MainThreadFrameObserver(RenderWidgetHost* render_widget_host);
447 ~MainThreadFrameObserver() override; 453 ~MainThreadFrameObserver() override;
448 454
449 // Synchronizes the browser main thread with the renderer main thread and impl 455 // Synchronizes the browser main thread with the renderer main thread and impl
450 // thread. 456 // thread.
451 void Wait(); 457 void Wait();
452 458
453 // Overridden IPC::Listener methods. 459 // Overridden IPC::Listener methods.
454 bool OnMessageReceived(const IPC::Message& msg) override; 460 bool OnMessageReceived(const IPC::Message& msg) override;
455 461
456 private: 462 private:
457 void Quit(); 463 void Quit();
458 464
459 RenderWidgetHost* render_widget_host_; 465 RenderWidgetHost* render_widget_host_;
460 scoped_ptr<base::RunLoop> run_loop_; 466 scoped_ptr<base::RunLoop> run_loop_;
461 int routing_id_; 467 int routing_id_;
462 468
463 DISALLOW_COPY_AND_ASSIGN(MainThreadFrameObserver); 469 DISALLOW_COPY_AND_ASSIGN(MainThreadFrameObserver);
464 }; 470 };
465 471
472 // Watches for an input msg to be consumed.
473 class InputMsgWatcher : public BrowserMessageFilter {
474 public:
475 InputMsgWatcher(RenderWidgetHost* render_widget_host,
476 blink::WebInputEvent::Type type);
477
478 // Wait until ack message occurs, returning the ack result from
479 // the message.
480 uint32_t WaitForAck();
481
482 private:
483 ~InputMsgWatcher() override;
484
485 // Overridden BrowserMessageFilter methods.
486 bool OnMessageReceived(const IPC::Message& message) override;
487
488 void ReceivedAck(blink::WebInputEvent::Type ack_type, uint32_t ack_state);
489
490 blink::WebInputEvent::Type wait_for_type_;
491 uint32_t ack_result_;
492 base::Closure quit_;
493
494 DISALLOW_COPY_AND_ASSIGN(InputMsgWatcher);
495 };
496
466 } // namespace content 497 } // namespace content
467 498
468 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ 499 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « content/content_tests.gypi ('k') | content/public/test/browser_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698