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

Side by Side Diff: chrome/browser/renderer_host/test_render_view_host.cc

Issue 18351: Put back render view host tests (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/renderer_host/test_render_view_host.h" 5 #include "chrome/browser/renderer_host/test_render_view_host.h"
6 6
7 TestRenderViewHost::TestRenderViewHost(SiteInstance* instance,
8 RenderViewHostDelegate* delegate,
9 int routing_id,
10 base::WaitableEvent* modal_dialog_event)
11 : RenderViewHost(instance, delegate, routing_id, modal_dialog_event),
12 immediate_before_unload(false),
13 render_view_created_(false),
14 delete_counter_(NULL) {
15 set_view(new TestRenderWidgetHostView());
16 }
17
18 TestRenderViewHost::~TestRenderViewHost() {
19 if (delete_counter_)
20 ++*delete_counter_;
21
22 // Since this isn't a traditional view, we have to delete it.
23 delete view_;
24 }
25
26 bool TestRenderViewHost::CreateRenderView() {
27 DCHECK(!render_view_created_);
28 render_view_created_ = true;
29 return true;
30 }
31
32 bool TestRenderViewHost::IsRenderViewLive() const {
33 return render_view_created_;
34 }
35
36 void TestRenderViewHost::TestOnMessageReceived(const IPC::Message& msg) {
37 OnMessageReceived(msg);
38 }
39
7 void TestRenderViewHost::SendNavigate(int page_id, const GURL& url) { 40 void TestRenderViewHost::SendNavigate(int page_id, const GURL& url) {
8 ViewHostMsg_FrameNavigate_Params params; 41 ViewHostMsg_FrameNavigate_Params params;
9 params.is_post = false; 42 params.is_post = false;
10 params.page_id = page_id; 43 params.page_id = page_id;
11 params.is_content_filtered = false; 44 params.is_content_filtered = false;
12 params.url = url; 45 params.url = url;
13 params.should_update_history = true; 46 params.should_update_history = true;
14 params.transition = PageTransition::LINK; 47 params.transition = PageTransition::LINK;
15 params.is_post = false; 48 params.is_post = false;
16 49
(...skipping 15 matching lines...) Expand all
32 65
33 void RenderViewHostTestHarness::TearDown() { 66 void RenderViewHostTestHarness::TearDown() {
34 contents_->CloseContents(); 67 contents_->CloseContents();
35 contents_ = NULL; 68 contents_ = NULL;
36 controller_ = NULL; 69 controller_ = NULL;
37 70
38 // Make sure that we flush any messages related to WebContents destruction 71 // Make sure that we flush any messages related to WebContents destruction
39 // before we destroy the profile. 72 // before we destroy the profile.
40 MessageLoop::current()->RunAllPending(); 73 MessageLoop::current()->RunAllPending();
41 } 74 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/test_render_view_host.h ('k') | chrome/browser/tab_contents/web_contents_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698