| 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 #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> |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 const gfx::Point& point); | 109 const gfx::Point& point); |
| 110 | 110 |
| 111 // Simulates asynchronously a mouse enter/move/leave event. | 111 // Simulates asynchronously a mouse enter/move/leave event. |
| 112 void SimulateMouseEvent(WebContents* web_contents, | 112 void SimulateMouseEvent(WebContents* web_contents, |
| 113 blink::WebInputEvent::Type type, | 113 blink::WebInputEvent::Type type, |
| 114 const gfx::Point& point); | 114 const gfx::Point& point); |
| 115 | 115 |
| 116 // Taps the screen at |point|. | 116 // Taps the screen at |point|. |
| 117 void SimulateTapAt(WebContents* web_contents, const gfx::Point& point); | 117 void SimulateTapAt(WebContents* web_contents, const gfx::Point& point); |
| 118 | 118 |
| 119 // Generates a TouchStart at |point|. |
| 120 void SimulateTouchPressAt(WebContents* web_contents, const gfx::Point& point); |
| 121 |
| 119 // Taps the screen with modifires at |point|. | 122 // Taps the screen with modifires at |point|. |
| 120 void SimulateTapWithModifiersAt(WebContents* web_contents, | 123 void SimulateTapWithModifiersAt(WebContents* web_contents, |
| 121 unsigned Modifiers, | 124 unsigned Modifiers, |
| 122 const gfx::Point& point); | 125 const gfx::Point& point); |
| 123 | 126 |
| 124 // Sends a key press asynchronously. | 127 // Sends a key press asynchronously. |
| 125 // The native code of the key event will be set to InvalidNativeKeycode(). | 128 // The native code of the key event will be set to InvalidNativeKeycode(). |
| 126 // |key_code| alone is good enough for scenarios that only need the char | 129 // |key_code| alone is good enough for scenarios that only need the char |
| 127 // value represented by a key event and not the physical key on the keyboard | 130 // value represented by a key event and not the physical key on the keyboard |
| 128 // or the keyboard layout. | 131 // or the keyboard layout. |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 // Callback to WebContentCreated(). Cached so that we can unregister it. | 397 // Callback to WebContentCreated(). Cached so that we can unregister it. |
| 395 base::Callback<void(WebContents*)> web_contents_created_callback_; | 398 base::Callback<void(WebContents*)> web_contents_created_callback_; |
| 396 | 399 |
| 397 WebContents* web_contents_; | 400 WebContents* web_contents_; |
| 398 scoped_ptr<RenderViewCreatedObserver> child_observer_; | 401 scoped_ptr<RenderViewCreatedObserver> child_observer_; |
| 399 scoped_refptr<MessageLoopRunner> runner_; | 402 scoped_refptr<MessageLoopRunner> runner_; |
| 400 | 403 |
| 401 DISALLOW_COPY_AND_ASSIGN(WebContentsAddedObserver); | 404 DISALLOW_COPY_AND_ASSIGN(WebContentsAddedObserver); |
| 402 }; | 405 }; |
| 403 | 406 |
| 407 // Request a new frame be drawn, returns false if request fails. |
| 408 bool RequestFrame(WebContents* web_contents); |
| 409 |
| 404 // Watches compositor frame changes, blocking until a frame has been | 410 // Watches compositor frame changes, blocking until a frame has been |
| 405 // composited. This class is intended to be run on the main thread; to | 411 // composited. This class is intended to be run on the main thread; to |
| 406 // synchronize the main thread against the impl thread. | 412 // synchronize the main thread against the impl thread. |
| 407 class FrameWatcher : public BrowserMessageFilter { | 413 class FrameWatcher : public BrowserMessageFilter { |
| 408 public: | 414 public: |
| 409 FrameWatcher(); | 415 FrameWatcher(); |
| 410 | 416 |
| 417 // Listen for new frames from the |web_contents| renderer process. |
| 418 void AttachTo(WebContents* web_contents); |
| 419 |
| 411 // Wait for |frames_to_wait| swap mesages from the compositor. | 420 // Wait for |frames_to_wait| swap mesages from the compositor. |
| 412 void WaitFrames(int frames_to_wait); | 421 void WaitFrames(int frames_to_wait); |
| 413 | 422 |
| 414 private: | 423 private: |
| 415 ~FrameWatcher() override; | 424 ~FrameWatcher() override; |
| 416 | 425 |
| 417 // Overridden BrowserMessageFilter methods. | 426 // Overridden BrowserMessageFilter methods. |
| 418 bool OnMessageReceived(const IPC::Message& message) override; | 427 bool OnMessageReceived(const IPC::Message& message) override; |
| 419 | 428 |
| 420 void ReceivedFrameSwap(); | 429 void ReceivedFrameSwap(); |
| 421 | 430 |
| 422 int frames_to_wait_; | 431 int frames_to_wait_; |
| 423 base::Closure quit_; | 432 base::Closure quit_; |
| 424 | 433 |
| 425 DISALLOW_COPY_AND_ASSIGN(FrameWatcher); | 434 DISALLOW_COPY_AND_ASSIGN(FrameWatcher); |
| 426 }; | 435 }; |
| 427 | 436 |
| 428 } // namespace content | 437 } // namespace content |
| 429 | 438 |
| 430 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 439 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
| OLD | NEW |