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

Side by Side Diff: chrome/test/base/chrome_render_view_test.cc

Issue 190663012: Run ContentMain in a browser_test's browser process. This removes duplication of code in the browse… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: try to fix android by restoring old path just for it Created 6 years, 9 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
« no previous file with comments | « chrome/test/base/chrome_render_view_test.h ('k') | chrome/test/base/chrome_test_launcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/test/base/chrome_render_view_test.h" 5 #include "chrome/test/base/chrome_render_view_test.h"
6 6
7 #include "base/debug/leak_annotations.h" 7 #include "base/debug/leak_annotations.h"
8 #include "chrome/browser/chrome_content_browser_client.h"
9 #include "chrome/common/chrome_content_client.h"
8 #include "chrome/common/render_messages.h" 10 #include "chrome/common/render_messages.h"
11 #include "chrome/renderer/chrome_content_renderer_client.h"
9 #include "chrome/renderer/extensions/chrome_v8_context_set.h" 12 #include "chrome/renderer/extensions/chrome_v8_context_set.h"
10 #include "chrome/renderer/extensions/chrome_v8_extension.h" 13 #include "chrome/renderer/extensions/chrome_v8_extension.h"
11 #include "chrome/renderer/extensions/dispatcher.h" 14 #include "chrome/renderer/extensions/dispatcher.h"
12 #include "chrome/renderer/extensions/event_bindings.h" 15 #include "chrome/renderer/extensions/event_bindings.h"
13 #include "chrome/renderer/spellchecker/spellcheck.h" 16 #include "chrome/renderer/spellchecker/spellcheck.h"
17 #include "chrome/test/base/chrome_unit_test_suite.h"
14 #include "components/autofill/content/renderer/autofill_agent.h" 18 #include "components/autofill/content/renderer/autofill_agent.h"
15 #include "components/autofill/content/renderer/password_autofill_agent.h" 19 #include "components/autofill/content/renderer/password_autofill_agent.h"
16 #include "components/autofill/content/renderer/test_password_autofill_agent.h" 20 #include "components/autofill/content/renderer/test_password_autofill_agent.h"
17 #include "components/autofill/content/renderer/test_password_generation_agent.h" 21 #include "components/autofill/content/renderer/test_password_generation_agent.h"
18 #include "content/public/browser/native_web_keyboard_event.h" 22 #include "content/public/browser/native_web_keyboard_event.h"
19 #include "content/public/common/renderer_preferences.h" 23 #include "content/public/common/renderer_preferences.h"
20 #include "content/public/renderer/render_view.h" 24 #include "content/public/renderer/render_view.h"
21 #include "extensions/browser/extension_function_dispatcher.h" 25 #include "extensions/browser/extension_function_dispatcher.h"
22 #include "extensions/common/extension.h" 26 #include "extensions/common/extension.h"
23 #include "grit/renderer_resources.h" 27 #include "grit/renderer_resources.h"
(...skipping 20 matching lines...) Expand all
44 using autofill::PasswordAutofillAgent; 48 using autofill::PasswordAutofillAgent;
45 using autofill::PasswordGenerationAgent; 49 using autofill::PasswordGenerationAgent;
46 50
47 ChromeRenderViewTest::ChromeRenderViewTest() : extension_dispatcher_(NULL) { 51 ChromeRenderViewTest::ChromeRenderViewTest() : extension_dispatcher_(NULL) {
48 } 52 }
49 53
50 ChromeRenderViewTest::~ChromeRenderViewTest() { 54 ChromeRenderViewTest::~ChromeRenderViewTest() {
51 } 55 }
52 56
53 void ChromeRenderViewTest::SetUp() { 57 void ChromeRenderViewTest::SetUp() {
58 ChromeUnitTestSuite::InitializeProviders();
59 ChromeUnitTestSuite::InitializeResourceBundle();
60
54 chrome_render_thread_ = new ChromeMockRenderThread(); 61 chrome_render_thread_ = new ChromeMockRenderThread();
55 render_thread_.reset(chrome_render_thread_); 62 render_thread_.reset(chrome_render_thread_);
56 63
57 content::SetRendererClientForTesting(&chrome_content_renderer_client_);
58 extension_dispatcher_ = new extensions::Dispatcher(); 64 extension_dispatcher_ = new extensions::Dispatcher();
59 chrome_content_renderer_client_.SetExtensionDispatcher(extension_dispatcher_);
60 #if defined(ENABLE_SPELLCHECK)
61 chrome_content_renderer_client_.SetSpellcheck(new SpellCheck());
62 #endif
63 65
64 content::RenderViewTest::SetUp(); 66 content::RenderViewTest::SetUp();
65 67
66 // RenderView doesn't expose its Agent objects, because it has no need to 68 // RenderView doesn't expose its Agent objects, because it has no need to
67 // store them directly (they're stored as RenderViewObserver*). So just 69 // store them directly (they're stored as RenderViewObserver*). So just
68 // create another set. 70 // create another set.
69 password_autofill_ = new autofill::TestPasswordAutofillAgent(view_); 71 password_autofill_ = new autofill::TestPasswordAutofillAgent(view_);
70 password_generation_ = new autofill::TestPasswordGenerationAgent(view_); 72 password_generation_ = new autofill::TestPasswordGenerationAgent(view_);
71 autofill_agent_ = 73 autofill_agent_ =
72 new AutofillAgent(view_, password_autofill_, password_generation_); 74 new AutofillAgent(view_, password_autofill_, password_generation_);
73 } 75 }
74 76
75 void ChromeRenderViewTest::TearDown() { 77 void ChromeRenderViewTest::TearDown() {
76 extension_dispatcher_->OnRenderProcessShutdown(); 78 extension_dispatcher_->OnRenderProcessShutdown();
77 extension_dispatcher_ = NULL; 79 extension_dispatcher_ = NULL;
78 80
79 #if defined(LEAK_SANITIZER) 81 #if defined(LEAK_SANITIZER)
80 // Do this before shutting down V8 in RenderViewTest::TearDown(). 82 // Do this before shutting down V8 in RenderViewTest::TearDown().
81 // http://crbug.com/328552 83 // http://crbug.com/328552
82 __lsan_do_leak_check(); 84 __lsan_do_leak_check();
83 #endif 85 #endif
84 content::RenderViewTest::TearDown(); 86 content::RenderViewTest::TearDown();
85 } 87 }
88
89 content::ContentClient* ChromeRenderViewTest::CreateContentClient() {
90 return new ChromeContentClient();
91 }
92
93 content::ContentBrowserClient*
94 ChromeRenderViewTest::CreateContentBrowserClient() {
95 return new chrome::ChromeContentBrowserClient();
96 }
97
98 content::ContentRendererClient*
99 ChromeRenderViewTest::CreateContentRendererClient() {
100 ChromeContentRendererClient* client = new ChromeContentRendererClient();
101 client->SetExtensionDispatcher(extension_dispatcher_);
102 #if defined(ENABLE_SPELLCHECK)
103 client->SetSpellcheck(new SpellCheck());
104 #endif
105 return client;
106 }
OLDNEW
« no previous file with comments | « chrome/test/base/chrome_render_view_test.h ('k') | chrome/test/base/chrome_test_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698