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

Side by Side Diff: content/browser/renderer_host/render_process_host_browsertest.cc

Issue 2766263009: Convert content ConnectionFilter to OnBindInterface (Closed)
Patch Set: . Created 3 years, 8 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/browser/renderer_host/render_process_host_impl.h" 9 #include "content/browser/renderer_host/render_process_host_impl.h"
10 #include "content/common/child_process_messages.h" 10 #include "content/common/child_process_messages.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 GURL test_url = embedded_test_server()->GetURL("/simple_page.html"); 223 GURL test_url = embedded_test_server()->GetURL("/simple_page.html");
224 NavigateToURL(shell(), test_url); 224 NavigateToURL(shell(), test_url);
225 RenderProcessHost* rph = 225 RenderProcessHost* rph =
226 shell()->web_contents()->GetMainFrame()->GetProcess(); 226 shell()->web_contents()->GetMainFrame()->GetProcess();
227 227
228 host_destructions_ = 0; 228 host_destructions_ = 0;
229 process_exits_ = 0; 229 process_exits_ = 0;
230 rph->AddObserver(this); 230 rph->AddObserver(this);
231 231
232 mojom::TestServicePtr service; 232 mojom::TestServicePtr service;
233 rph->GetRemoteInterfaces()->GetInterface(&service); 233 BindInterface(rph, &service);
234 234
235 base::RunLoop run_loop; 235 base::RunLoop run_loop;
236 set_process_exit_callback(run_loop.QuitClosure()); 236 set_process_exit_callback(run_loop.QuitClosure());
237 237
238 // Should reply with a bad message and cause process death. 238 // Should reply with a bad message and cause process death.
239 service->DoSomething(base::Bind(&base::DoNothing)); 239 service->DoSomething(base::Bind(&base::DoNothing));
240 240
241 run_loop.Run(); 241 run_loop.Run();
242 242
243 EXPECT_EQ(1, process_exits_); 243 EXPECT_EQ(1, process_exits_);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 292
293 // No point in running the rest of the test if this is wrong. 293 // No point in running the rest of the test if this is wrong.
294 ASSERT_EQ(1, rph->get_audio_stream_count_for_testing()); 294 ASSERT_EQ(1, rph->get_audio_stream_count_for_testing());
295 } 295 }
296 296
297 host_destructions_ = 0; 297 host_destructions_ = 0;
298 process_exits_ = 0; 298 process_exits_ = 0;
299 rph->AddObserver(this); 299 rph->AddObserver(this);
300 300
301 mojom::TestServicePtr service; 301 mojom::TestServicePtr service;
302 rph->GetRemoteInterfaces()->GetInterface(&service); 302 BindInterface(rph, &service);
303 303
304 { 304 {
305 // Force a bad message event to occur which will terminate the renderer. 305 // Force a bad message event to occur which will terminate the renderer.
306 // Note: We post task the QuitClosure since RenderProcessExited() is called 306 // Note: We post task the QuitClosure since RenderProcessExited() is called
307 // before destroying BrowserMessageFilters; and the next portion of the test 307 // before destroying BrowserMessageFilters; and the next portion of the test
308 // must run after these notifications have been delivered. 308 // must run after these notifications have been delivered.
309 base::RunLoop run_loop; 309 base::RunLoop run_loop;
310 set_process_exit_callback(media::BindToCurrentLoop(run_loop.QuitClosure())); 310 set_process_exit_callback(media::BindToCurrentLoop(run_loop.QuitClosure()));
311 service->DoSomething(base::Bind(&base::DoNothing)); 311 service->DoSomething(base::Bind(&base::DoNothing));
312 run_loop.Run(); 312 run_loop.Run();
(...skipping 11 matching lines...) Expand all
324 // Verify shutdown went as expected. 324 // Verify shutdown went as expected.
325 EXPECT_EQ(0, rph->get_audio_stream_count_for_testing()); 325 EXPECT_EQ(0, rph->get_audio_stream_count_for_testing());
326 EXPECT_EQ(1, process_exits_); 326 EXPECT_EQ(1, process_exits_);
327 EXPECT_EQ(0, host_destructions_); 327 EXPECT_EQ(0, host_destructions_);
328 if (!host_destructions_) 328 if (!host_destructions_)
329 rph->RemoveObserver(this); 329 rph->RemoveObserver(this);
330 } 330 }
331 331
332 } // namespace 332 } // namespace
333 } // namespace content 333 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/mojo_sandbox_browsertest.cc ('k') | content/browser/renderer_host/render_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698