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

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

Issue 11094080: Browser Plugin: More robust recovery from guest crash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed part of test that is no longer valid Created 8 years, 2 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 | Annotate | Revision Log
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/browser_plugin/test_browser_plugin_guest.h" 5 #include "content/browser/browser_plugin/test_browser_plugin_guest.h"
6 6
7 #include "base/test/test_timeouts.h" 7 #include "base/test/test_timeouts.h"
8 #include "content/browser/renderer_host/render_view_host_impl.h" 8 #include "content/browser/renderer_host/render_view_host_impl.h"
9 #include "content/browser/web_contents/web_contents_impl.h" 9 #include "content/browser/web_contents/web_contents_impl.h"
10 #include "content/common/browser_plugin_messages.h" 10 #include "content/common/browser_plugin_messages.h"
11 #include "content/public/browser/notification_types.h" 11 #include "content/public/browser/notification_types.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 class BrowserPluginGuest; 15 class BrowserPluginGuest;
16 16
17 TestBrowserPluginGuest::TestBrowserPluginGuest( 17 TestBrowserPluginGuest::TestBrowserPluginGuest(
18 int instance_id, 18 int instance_id,
19 WebContentsImpl* web_contents, 19 WebContentsImpl* web_contents,
20 RenderViewHost* render_view_host) 20 RenderViewHost* render_view_host)
21 : BrowserPluginGuest(instance_id, web_contents, render_view_host), 21 : BrowserPluginGuest(instance_id, web_contents, render_view_host),
22 update_rect_count_(0), 22 update_rect_count_(0),
23 damage_buffer_call_count_(0), 23 damage_buffer_call_count_(0),
24 crash_observed_(false), 24 crash_observed_(false),
25 focus_observed_(false), 25 focus_observed_(false),
26 advance_focus_observed_(false), 26 advance_focus_observed_(false),
27 was_hidden_observed_(false), 27 was_hidden_observed_(false),
28 stop_observed_(false), 28 stop_observed_(false),
29 reload_observed_(false), 29 reload_observed_(false),
30 set_damage_buffer_observed_(false),
31 input_observed_(false),
30 waiting_for_damage_buffer_with_size_(false), 32 waiting_for_damage_buffer_with_size_(false),
31 last_damage_buffer_size_(gfx::Size()) { 33 last_damage_buffer_size_(gfx::Size()) {
32 // Listen to visibility changes so that a test can wait for these changes. 34 // Listen to visibility changes so that a test can wait for these changes.
33 notification_registrar_.Add(this, 35 notification_registrar_.Add(this,
34 NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, 36 NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED,
35 Source<WebContents>(web_contents)); 37 Source<WebContents>(web_contents));
36 } 38 }
37 39
38 TestBrowserPluginGuest::~TestBrowserPluginGuest() { 40 TestBrowserPluginGuest::~TestBrowserPluginGuest() {
39 } 41 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 95 }
94 96
95 void TestBrowserPluginGuest::RenderViewGone(base::TerminationStatus status) { 97 void TestBrowserPluginGuest::RenderViewGone(base::TerminationStatus status) {
96 crash_observed_ = true; 98 crash_observed_ = true;
97 LOG(INFO) << "Guest crashed"; 99 LOG(INFO) << "Guest crashed";
98 if (crash_message_loop_runner_) 100 if (crash_message_loop_runner_)
99 crash_message_loop_runner_->Quit(); 101 crash_message_loop_runner_->Quit();
100 BrowserPluginGuest::RenderViewGone(status); 102 BrowserPluginGuest::RenderViewGone(status);
101 } 103 }
102 104
105 void TestBrowserPluginGuest::HandleInputEvent(
106 RenderViewHost* render_view_host,
107 const gfx::Rect& guest_rect,
108 const WebKit::WebInputEvent& event,
109 IPC::Message* reply_message) {
110 BrowserPluginGuest::HandleInputEvent(render_view_host,
111 guest_rect,
112 event,
113 reply_message);
114 input_observed_ = true;
115 if (input_message_loop_runner_)
116 input_message_loop_runner_->Quit();
117 }
118
103 void TestBrowserPluginGuest::WaitForCrashed() { 119 void TestBrowserPluginGuest::WaitForCrashed() {
104 // Check if we already observed a guest crash, return immediately if so. 120 // Check if we already observed a guest crash, return immediately if so.
105 if (crash_observed_) 121 if (crash_observed_)
106 return; 122 return;
107 123
108 crash_message_loop_runner_ = new MessageLoopRunner(); 124 crash_message_loop_runner_ = new MessageLoopRunner();
109 crash_message_loop_runner_->Run(); 125 crash_message_loop_runner_->Run();
110 } 126 }
111 127
112 void TestBrowserPluginGuest::WaitForFocus() { 128 void TestBrowserPluginGuest::WaitForFocus() {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 if (stop_observed_) { 164 if (stop_observed_) {
149 stop_observed_ = false; 165 stop_observed_ = false;
150 return; 166 return;
151 } 167 }
152 168
153 stop_message_loop_runner_ = new MessageLoopRunner(); 169 stop_message_loop_runner_ = new MessageLoopRunner();
154 stop_message_loop_runner_->Run(); 170 stop_message_loop_runner_->Run();
155 stop_observed_ = false; 171 stop_observed_ = false;
156 } 172 }
157 173
174 void TestBrowserPluginGuest::WaitForInput() {
175 if (input_observed_) {
176 input_observed_ = false;
177 return;
178 }
179
180 input_message_loop_runner_ = new MessageLoopRunner();
181 input_message_loop_runner_->Run();
182 input_observed_ = false;
183 }
184
158 void TestBrowserPluginGuest::SetFocus(bool focused) { 185 void TestBrowserPluginGuest::SetFocus(bool focused) {
159 focus_observed_ = true; 186 focus_observed_ = true;
160 if (focus_message_loop_runner_) 187 if (focus_message_loop_runner_)
161 focus_message_loop_runner_->Quit(); 188 focus_message_loop_runner_->Quit();
162 BrowserPluginGuest::SetFocus(focused); 189 BrowserPluginGuest::SetFocus(focused);
163 } 190 }
164 191
165 bool TestBrowserPluginGuest::ViewTakeFocus(bool reverse) { 192 bool TestBrowserPluginGuest::ViewTakeFocus(bool reverse) {
166 advance_focus_observed_ = true; 193 advance_focus_observed_ = true;
167 if (advance_focus_message_loop_runner_) 194 if (advance_focus_message_loop_runner_)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 BrowserPluginGuest::SetDamageBuffer( 230 BrowserPluginGuest::SetDamageBuffer(
204 damage_buffer, 231 damage_buffer,
205 #if defined(OS_WIN) 232 #if defined(OS_WIN)
206 damage_buffer_size, 233 damage_buffer_size,
207 #endif 234 #endif
208 damage_view_size, 235 damage_view_size,
209 scale_factor); 236 scale_factor);
210 } 237 }
211 238
212 } // namespace content 239 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/test_browser_plugin_guest.h ('k') | content/renderer/browser_plugin/browser_plugin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698