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

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: Remove TestTimeoutTracker and wait indefinitely in tests instead, fix one include. 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
14 class WebContentsImpl;
15
16 namespace IPC {
17 class Message;
jam 2012/09/17 22:13:36 not needed by definition since it's used in an ove
lazyboy 2012/09/17 22:37:48 Done.
18 }
19
20 namespace content {
21
22 class RenderProcessHost;
23 class RenderViewHost;
24
25 // Test class for BrowserPluginGuest.
26 //
27 // Provides utilities to wait for certain state/messages in BrowserPluginGuest
28 // to be used in tests.
29 class TestBrowserPluginGuest : public BrowserPluginGuest,
30 public NotificationObserver {
31 public:
32 TestBrowserPluginGuest(int instance_id,
33 WebContentsImpl* web_contents,
34 RenderViewHost* render_view_host);
35 virtual ~TestBrowserPluginGuest();
36
37 // NotificationObserver method override.
38 virtual void Observe(int type,
39 const NotificationSource& source,
40 const NotificationDetails& details) OVERRIDE;
41
42 // Overridden methods from BrowserPluginGuest to intercept in test objects.
43 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE;
44 virtual void SetFocus(bool focused) OVERRIDE;
45 virtual bool ViewTakeFocus(bool reverse) OVERRIDE;
46
47 // Test utilities to wait for a event we are interested in.
48 // Waits until UpdateRect message is sent from the guest, meaning it is
49 // ready/rendered.
50 void WaitForUpdateRectMsg();
51 // Waits until UpdateRect message with a specific size is sent from the guest.
52 void WaitForUpdateRectMsgWithSize(int width, int height);
53 // Waits for focus to reach this guest.
54 void WaitForFocus();
55 // Wait for focus to move out of this guest.
56 void WaitForAdvanceFocus();
57 // Wait until the guest is hidden.
58 void WaitUntilHidden();
59 // Waits until guest crashes.
60 void WaitForCrashed();
61
62 private:
63 // Overridden methods from BrowserPluginGuest to intercept in test objects.
64 virtual void SendMessageToEmbedder(IPC::Message* msg) OVERRIDE;
65
66 int update_rect_count_;
67 bool crash_observed_;
68 bool focus_observed_;
69 bool advance_focus_observed_;
70 bool was_hidden_observed_;
71
72 // For WaitForUpdateRectMsgWithSize().
73 bool waiting_for_update_rect_msg_with_size_;
74 int expected_width_;
75 int expected_height_;
76
77 int last_update_rect_width_;
78 int last_update_rect_height_;
79
80 scoped_refptr<MessageLoopRunner> send_message_loop_runner_;
81 scoped_refptr<MessageLoopRunner> crash_message_loop_runner_;
82 scoped_refptr<MessageLoopRunner> focus_message_loop_runner_;
83 scoped_refptr<MessageLoopRunner> advance_focus_message_loop_runner_;
84 scoped_refptr<MessageLoopRunner> was_hidden_message_loop_runner_;
85
86 // A scoped container for notification registries.
87 NotificationRegistrar registrar_;
88
89 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginGuest);
90 };
91
92 } // namespace content
93
94 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698