OLD | NEW |
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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "content/browser/renderer_host/render_process_host_impl.h" | 6 #include "content/browser/renderer_host/render_process_host_impl.h" |
7 #include "content/common/child_process_messages.h" | 7 #include "content/common/child_process_messages.h" |
8 #include "content/public/browser/render_process_host.h" | 8 #include "content/public/browser/render_process_host.h" |
9 #include "content/public/browser/render_process_host_observer.h" | 9 #include "content/public/browser/render_process_host_observer.h" |
10 #include "content/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 "ObserverLogger::RenderProcessHostDestroyed ", logging_string); | 190 "ObserverLogger::RenderProcessHostDestroyed ", logging_string); |
191 | 191 |
192 // If the test fails, and somehow the RPH is still alive somehow, at least | 192 // If the test fails, and somehow the RPH is still alive somehow, at least |
193 // deregister the observers so that the test fails and doesn't also crash. | 193 // deregister the observers so that the test fails and doesn't also crash. |
194 if (!observer_logger.host_destroyed()) { | 194 if (!observer_logger.host_destroyed()) { |
195 rph->RemoveObserver(&shell_closer); | 195 rph->RemoveObserver(&shell_closer); |
196 rph->RemoveObserver(&observer_logger); | 196 rph->RemoveObserver(&observer_logger); |
197 } | 197 } |
198 } | 198 } |
199 | 199 |
200 #if defined(OS_WIN) | |
201 // Provides functionality to test renderer processes with the Win32K lockdown | |
202 // process mitigation. | |
203 class Win32KLockdownRendererProcessHostTest : public RenderProcessHostTest { | |
204 public: | |
205 Win32KLockdownRendererProcessHostTest() {} | |
206 | |
207 ~Win32KLockdownRendererProcessHostTest() override {} | |
208 | |
209 protected: | |
210 void SetUp() override { | |
211 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
212 command_line->AppendSwitch(switches::kEnableWin32kRendererLockDown); | |
213 RenderProcessHostTest::SetUp(); | |
214 } | |
215 | |
216 private: | |
217 DISALLOW_COPY_AND_ASSIGN(Win32KLockdownRendererProcessHostTest); | |
218 }; | |
219 | |
220 // Tests whether navigation requests with the Win32K lockdown mitigation set | |
221 // work correctly. | |
222 IN_PROC_BROWSER_TEST_F(Win32KLockdownRendererProcessHostTest, | |
223 RendererWin32KLockdownNavigationTest) { | |
224 if (base::win::GetVersion() < base::win::VERSION_WIN8) | |
225 return; | |
226 | |
227 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | |
228 | |
229 GURL test_url = embedded_test_server()->GetURL("/simple_page.html"); | |
230 NavigateToURL(shell(), test_url); | |
231 | |
232 EXPECT_EQ(1, RenderProcessHostCount()); | |
233 EXPECT_EQ(0, process_exits_); | |
234 } | |
235 #endif | |
236 | |
237 } // namespace | 200 } // namespace |
238 } // namespace content | 201 } // namespace content |
OLD | NEW |