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

Side by Side Diff: content/test/content_browser_test_test.cc

Issue 2810903002: Revert of Allow handles through for official builds too (partial revert) (patchset #3 id:40001 of h… (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
« no previous file with comments | « content/common/sandbox_win.cc ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/public/test/content_browser_test.h" 5 #include "content/public/test/content_browser_test.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/process/launch.h" 9 #include "base/process/launch.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/test/launcher/test_launcher.h" 12 #include "base/test/launcher/test_launcher.h"
13 #include "base/threading/thread_restrictions.h" 13 #include "base/threading/thread_restrictions.h"
14 #include "base/threading/thread_task_runner_handle.h" 14 #include "base/threading/thread_task_runner_handle.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "content/public/browser/render_process_host.h" 16 #include "content/public/browser/render_process_host.h"
17 #include "content/public/browser/render_process_host_observer.h" 17 #include "content/public/browser/render_process_host_observer.h"
18 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
19 #include "content/public/common/content_switches.h" 19 #include "content/public/common/content_switches.h"
20 #include "content/public/test/browser_test_utils.h" 20 #include "content/public/test/browser_test_utils.h"
21 #include "content/public/test/content_browser_test_utils.h" 21 #include "content/public/test/content_browser_test_utils.h"
22 #include "content/public/test/test_launcher.h" 22 #include "content/public/test/test_launcher.h"
23 #include "content/public/test/test_utils.h" 23 #include "content/public/test/test_utils.h"
24 #include "content/shell/browser/shell.h" 24 #include "content/shell/browser/shell.h"
25 #include "content/shell/common/shell_switches.h" 25 #include "content/shell/common/shell_switches.h"
26 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
27 27
28 #if defined(OS_WIN)
29 #include "base/win/windows_version.h"
30 #endif
31
28 namespace content { 32 namespace content {
29 33
30 // Disabled on official builds because symbolization in sandboxes processes 34 // Disabled on official builds because symbolization in sandboxes processes
31 // opens up security holes. 35 // opens up security holes.
32 // On Android symbolization happens in one step after all the tests ran, so this 36 // On Android symbolization happens in one step after all the tests ran, so this
33 // test doesn't work there. 37 // test doesn't work there.
34 // TODO(mac): figure out why symbolization doesn't happen in the renderer. 38 // TODO(mac): figure out why symbolization doesn't happen in the renderer.
35 // http://crbug.com/521456 39 // http://crbug.com/521456
36 // TODO(win): send PDB files for component build. http://crbug.com/521459 40 // TODO(win): send PDB files for component build. http://crbug.com/521459
37 #if !defined(OFFICIAL_BUILD) && !defined(OS_ANDROID) && !defined(OS_MACOSX) && \ 41 #if !defined(OFFICIAL_BUILD) && !defined(OS_ANDROID) && !defined(OS_MACOSX) && \
(...skipping 24 matching lines...) Expand all
62 scoped_refptr<MessageLoopRunner> message_loop_runner = new MessageLoopRunner; 66 scoped_refptr<MessageLoopRunner> message_loop_runner = new MessageLoopRunner;
63 CrashObserver crash_observer(message_loop_runner->QuitClosure()); 67 CrashObserver crash_observer(message_loop_runner->QuitClosure());
64 shell()->web_contents()->GetRenderProcessHost()->AddObserver(&crash_observer); 68 shell()->web_contents()->GetRenderProcessHost()->AddObserver(&crash_observer);
65 69
66 NavigateToURL(shell(), GURL("chrome:crash")); 70 NavigateToURL(shell(), GURL("chrome:crash"));
67 message_loop_runner->Run(); 71 message_loop_runner->Run();
68 } 72 }
69 73
70 // Tests that browser tests print the callstack when a child process crashes. 74 // Tests that browser tests print the callstack when a child process crashes.
71 IN_PROC_BROWSER_TEST_F(ContentBrowserTest, RendererCrashCallStack) { 75 IN_PROC_BROWSER_TEST_F(ContentBrowserTest, RendererCrashCallStack) {
76 #if defined(OS_WIN)
77 // Matches the same condition in RouteStdioToConsole, which makes this test
78 // fail on XP.
79 if (base::win::GetVersion() < base::win::VERSION_VISTA)
80 return;
81 #endif
82
72 base::ThreadRestrictions::ScopedAllowIO allow_io_for_temp_dir; 83 base::ThreadRestrictions::ScopedAllowIO allow_io_for_temp_dir;
73 base::ScopedTempDir temp_dir; 84 base::ScopedTempDir temp_dir;
74 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 85 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
75 base::CommandLine new_test = 86 base::CommandLine new_test =
76 base::CommandLine(base::CommandLine::ForCurrentProcess()->GetProgram()); 87 base::CommandLine(base::CommandLine::ForCurrentProcess()->GetProgram());
77 new_test.AppendSwitchASCII(base::kGTestFilterFlag, 88 new_test.AppendSwitchASCII(base::kGTestFilterFlag,
78 "ContentBrowserTest.MANUAL_RendererCrash"); 89 "ContentBrowserTest.MANUAL_RendererCrash");
79 new_test.AppendSwitch(kRunManualTestsFlag); 90 new_test.AppendSwitch(kRunManualTestsFlag);
80 new_test.AppendSwitch(kSingleProcessTestsFlag); 91 new_test.AppendSwitch(kSingleProcessTestsFlag);
81 92
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 183
173 IN_PROC_BROWSER_TEST_F(ContentBrowserTest, NonNestableTask) { 184 IN_PROC_BROWSER_TEST_F(ContentBrowserTest, NonNestableTask) {
174 bool non_nested_task_ran = false; 185 bool non_nested_task_ran = false;
175 base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask( 186 base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask(
176 FROM_HERE, base::Bind(&CallbackChecker, &non_nested_task_ran)); 187 FROM_HERE, base::Bind(&CallbackChecker, &non_nested_task_ran));
177 content::RunAllPendingInMessageLoop(); 188 content::RunAllPendingInMessageLoop();
178 ASSERT_TRUE(non_nested_task_ran); 189 ASSERT_TRUE(non_nested_task_ran);
179 } 190 }
180 191
181 } // namespace content 192 } // namespace content
OLDNEW
« no previous file with comments | « content/common/sandbox_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698