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

Side by Side Diff: content/browser/browser_plugin/test_browser_plugin_guest.h

Issue 10868012: Browser Plugin: New Implementation (Browser Side) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master-trial-obrowser
Patch Set: @tott + Address comments + fix win_rel trybot flakiness Created 8 years, 3 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_
6 #define CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/process_util.h"
10 #include "content/browser/browser_plugin/browser_plugin_guest.h"
11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/test/test_utils.h"
13 #include "ipc/ipc_channel_handle.h"
14
15 class WebContentsImpl;
16
17 namespace content {
18
19 class RenderProcessHost;
20 class RenderViewHost;
21
22 // Test class for BrowserPluginGuest.
23 //
24 // Provides utilities to wait for certain state/messages in BrowserPluginGuest
25 // to be used in tests.
26 class TestBrowserPluginGuest : public BrowserPluginGuest,
27 public NotificationObserver {
28 public:
29 TestBrowserPluginGuest(int instance_id,
30 WebContentsImpl* web_contents,
31 RenderViewHost* render_view_host);
32 virtual ~TestBrowserPluginGuest();
33
34 // NotificationObserver method override.
35 virtual void Observe(int type,
36 const NotificationSource& source,
37 const NotificationDetails& details) OVERRIDE;
38
39 // Overridden methods from BrowserPluginGuest to intercept in test objects.
40 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE;
41 virtual void SetFocus(bool focused) OVERRIDE;
42 virtual bool ViewTakeFocus(bool reverse) OVERRIDE;
43
44 // Test utilities to wait for a event we are interested in, returns true if we
45 // timed out waiting for the event to happen.
46 // Waits until UpdateRect message is sent from the guest, meaning it is
47 // ready/rendered.
48 bool WaitForUpdateRectMsg();
49 // Waits until UpdateRect message with a specific size is sent from the guest.
50 bool WaitForUpdateRectMsgWithSize(int width, int height);
51 // Waits for focus to reach this guest.
52 bool WaitForFocus();
53 // Wait for focus to move out of this guest.
54 bool WaitForAdvanceFocus();
55 // Wait until the guest is hidden.
56 bool WaitUntilHidden();
57
58 // Waits until guest crashes.
59 void WaitForCrashed();
60
61 private:
62 // Overridden methods from BrowserPluginGuest to intercept in test objects.
63 virtual void SendMessageToEmbedder(IPC::Message* msg) OVERRIDE;
64
65 int update_rect_count_;
66 bool crash_observed_;
67 bool focus_observed_;
68 bool advance_focus_observed_;
69 bool was_hidden_observed_;
70
71 // For WaitForUpdateRectMsgWithSize().
72 bool waiting_for_update_rect_msg_with_size_;
73 int expected_width_;
74 int expected_height_;
75
76 int last_update_rect_width_;
77 int last_update_rect_height_;
78
79 scoped_refptr<MessageLoopRunner> send_message_loop_runner_;
80 scoped_refptr<MessageLoopRunner> crash_message_loop_runner_;
81 scoped_refptr<MessageLoopRunner> focus_message_loop_runner_;
82 scoped_refptr<MessageLoopRunner> advance_focus_message_loop_runner_;
83 scoped_refptr<MessageLoopRunner> was_hidden_message_loop_runner_;
84
85 // A scoped container for notification registries.
86 NotificationRegistrar registrar_;
87
88 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginGuest);
89 };
90
91 } // namespace content
92
93 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698