| OLD | NEW |
| 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 "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 void ChromeRenderViewTest::SetUp() { | 105 void ChromeRenderViewTest::SetUp() { |
| 106 ChromeUnitTestSuite::InitializeProviders(); | 106 ChromeUnitTestSuite::InitializeProviders(); |
| 107 ChromeUnitTestSuite::InitializeResourceBundle(); | 107 ChromeUnitTestSuite::InitializeResourceBundle(); |
| 108 | 108 |
| 109 chrome_render_thread_ = new ChromeMockRenderThread(); | 109 chrome_render_thread_ = new ChromeMockRenderThread(); |
| 110 render_thread_.reset(chrome_render_thread_); | 110 render_thread_.reset(chrome_render_thread_); |
| 111 | 111 |
| 112 content::RenderViewTest::SetUp(); | 112 content::RenderViewTest::SetUp(); |
| 113 | 113 |
| 114 RegisterMainFrameRemoteInterfaces(); | |
| 115 | |
| 116 // RenderFrame doesn't expose its Agent objects, because it has no need to | 114 // RenderFrame doesn't expose its Agent objects, because it has no need to |
| 117 // store them directly (they're stored as RenderFrameObserver*). So just | 115 // store them directly (they're stored as RenderFrameObserver*). So just |
| 118 // create another set. | 116 // create another set. |
| 119 password_autofill_agent_ = | 117 password_autofill_agent_ = |
| 120 new autofill::TestPasswordAutofillAgent(view_->GetMainRenderFrame()); | 118 new autofill::TestPasswordAutofillAgent(view_->GetMainRenderFrame()); |
| 121 password_generation_ = | 119 password_generation_ = |
| 122 new autofill::TestPasswordGenerationAgent(view_->GetMainRenderFrame(), | 120 new autofill::TestPasswordGenerationAgent(view_->GetMainRenderFrame(), |
| 123 password_autofill_agent_); | 121 password_autofill_agent_); |
| 124 autofill_agent_ = new NiceMock<MockAutofillAgent>(view_->GetMainRenderFrame(), | 122 autofill_agent_ = new NiceMock<MockAutofillAgent>(view_->GetMainRenderFrame(), |
| 125 password_autofill_agent_, | 123 password_autofill_agent_, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 151 return new ChromeContentBrowserClient(); | 149 return new ChromeContentBrowserClient(); |
| 152 } | 150 } |
| 153 | 151 |
| 154 content::ContentRendererClient* | 152 content::ContentRendererClient* |
| 155 ChromeRenderViewTest::CreateContentRendererClient() { | 153 ChromeRenderViewTest::CreateContentRendererClient() { |
| 156 ChromeContentRendererClient* client = new ChromeContentRendererClient(); | 154 ChromeContentRendererClient* client = new ChromeContentRendererClient(); |
| 157 InitChromeContentRendererClient(client); | 155 InitChromeContentRendererClient(client); |
| 158 return client; | 156 return client; |
| 159 } | 157 } |
| 160 | 158 |
| 161 void ChromeRenderViewTest::RegisterMainFrameRemoteInterfaces() {} | |
| 162 | |
| 163 void ChromeRenderViewTest::InitChromeContentRendererClient( | 159 void ChromeRenderViewTest::InitChromeContentRendererClient( |
| 164 ChromeContentRendererClient* client) { | 160 ChromeContentRendererClient* client) { |
| 165 #if defined(ENABLE_EXTENSIONS) | 161 #if defined(ENABLE_EXTENSIONS) |
| 166 extension_dispatcher_delegate_.reset( | 162 extension_dispatcher_delegate_.reset( |
| 167 new ChromeExtensionsDispatcherDelegate()); | 163 new ChromeExtensionsDispatcherDelegate()); |
| 168 ChromeExtensionsRendererClient* ext_client = | 164 ChromeExtensionsRendererClient* ext_client = |
| 169 ChromeExtensionsRendererClient::GetInstance(); | 165 ChromeExtensionsRendererClient::GetInstance(); |
| 170 ext_client->SetExtensionDispatcherForTest(base::WrapUnique( | 166 ext_client->SetExtensionDispatcherForTest(base::WrapUnique( |
| 171 new extensions::Dispatcher(extension_dispatcher_delegate_.get()))); | 167 new extensions::Dispatcher(extension_dispatcher_delegate_.get()))); |
| 172 #endif | 168 #endif |
| 173 #if defined(ENABLE_SPELLCHECK) | 169 #if defined(ENABLE_SPELLCHECK) |
| 174 client->SetSpellcheck(new SpellCheck()); | 170 client->SetSpellcheck(new SpellCheck()); |
| 175 #endif | 171 #endif |
| 176 } | 172 } |
| 177 | 173 |
| 178 void ChromeRenderViewTest::EnableUserGestureSimulationForAutofill() { | 174 void ChromeRenderViewTest::EnableUserGestureSimulationForAutofill() { |
| 179 EXPECT_CALL(*(static_cast<MockAutofillAgent*>(autofill_agent_)), | 175 EXPECT_CALL(*(static_cast<MockAutofillAgent*>(autofill_agent_)), |
| 180 IsUserGesture()).WillRepeatedly(Return(true)); | 176 IsUserGesture()).WillRepeatedly(Return(true)); |
| 181 } | 177 } |
| 182 | 178 |
| 183 void ChromeRenderViewTest::DisableUserGestureSimulationForAutofill() { | 179 void ChromeRenderViewTest::DisableUserGestureSimulationForAutofill() { |
| 184 EXPECT_CALL(*(static_cast<MockAutofillAgent*>(autofill_agent_)), | 180 EXPECT_CALL(*(static_cast<MockAutofillAgent*>(autofill_agent_)), |
| 185 IsUserGesture()).WillRepeatedly(Return(false)); | 181 IsUserGesture()).WillRepeatedly(Return(false)); |
| 186 } | 182 } |
| 187 | 183 |
| 188 void ChromeRenderViewTest::WaitForAutofillDidAssociateFormControl() { | 184 void ChromeRenderViewTest::WaitForAutofillDidAssociateFormControl() { |
| 189 static_cast<MockAutofillAgent*>(autofill_agent_) | 185 static_cast<MockAutofillAgent*>(autofill_agent_) |
| 190 ->WaitForAutofillDidAssociateFormControl(); | 186 ->WaitForAutofillDidAssociateFormControl(); |
| 191 } | 187 } |
| OLD | NEW |