OLD | NEW |
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" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "content/shell/browser/shell.h" | 22 #include "content/shell/browser/shell.h" |
23 #include "content/shell/common/shell_switches.h" | 23 #include "content/shell/common/shell_switches.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
25 | 25 |
26 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
27 #include "base/win/windows_version.h" | 27 #include "base/win/windows_version.h" |
28 #endif | 28 #endif |
29 | 29 |
30 namespace content { | 30 namespace content { |
31 | 31 |
| 32 // Disabled on official builds because symbolization in sandboxes processes |
| 33 // opens up security holes. |
32 // On Android symbolization happens in one step after all the tests ran, so this | 34 // On Android symbolization happens in one step after all the tests ran, so this |
33 // test doesn't work there. | 35 // test doesn't work there. |
34 // TODO(mac): figure out why symbolization doesn't happen in the renderer. | 36 // TODO(mac): figure out why symbolization doesn't happen in the renderer. |
35 // http://crbug.com/521456 | 37 // http://crbug.com/521456 |
36 // TODO(win): send PDB files for component build. http://crbug.com/521459 | 38 // TODO(win): send PDB files for component build. http://crbug.com/521459 |
37 #if !defined(OS_ANDROID) && !defined(OS_MACOSX) && \ | 39 #if !defined(OFFICIAL_BUILD) && !defined(OS_ANDROID) && !defined(OS_MACOSX) && \ |
38 !(defined(COMPONENT_BUILD) && defined(OS_WIN)) | 40 !(defined(COMPONENT_BUILD) && defined(OS_WIN)) |
39 | 41 |
40 IN_PROC_BROWSER_TEST_F(ContentBrowserTest, MANUAL_ShouldntRun) { | 42 IN_PROC_BROWSER_TEST_F(ContentBrowserTest, MANUAL_ShouldntRun) { |
41 // Ensures that tests with MANUAL_ prefix don't run automatically. | 43 // Ensures that tests with MANUAL_ prefix don't run automatically. |
42 ASSERT_TRUE(false); | 44 ASSERT_TRUE(false); |
43 } | 45 } |
44 | 46 |
45 class CrashObserver : public RenderProcessHostObserver { | 47 class CrashObserver : public RenderProcessHostObserver { |
46 public: | 48 public: |
47 CrashObserver(const base::Closure& quit_closure) | 49 CrashObserver(const base::Closure& quit_closure) |
(...skipping 30 matching lines...) Expand all Loading... |
78 | 80 |
79 base::ScopedTempDir temp_dir; | 81 base::ScopedTempDir temp_dir; |
80 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 82 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
81 base::CommandLine new_test = | 83 base::CommandLine new_test = |
82 base::CommandLine(base::CommandLine::ForCurrentProcess()->GetProgram()); | 84 base::CommandLine(base::CommandLine::ForCurrentProcess()->GetProgram()); |
83 new_test.AppendSwitchASCII(base::kGTestFilterFlag, | 85 new_test.AppendSwitchASCII(base::kGTestFilterFlag, |
84 "ContentBrowserTest.MANUAL_RendererCrash"); | 86 "ContentBrowserTest.MANUAL_RendererCrash"); |
85 new_test.AppendSwitch(kRunManualTestsFlag); | 87 new_test.AppendSwitch(kRunManualTestsFlag); |
86 new_test.AppendSwitch(kSingleProcessTestsFlag); | 88 new_test.AppendSwitch(kSingleProcessTestsFlag); |
87 | 89 |
88 #if defined(ADDRESS_SANITIZER) | |
89 // Per https://www.chromium.org/developers/testing/addresssanitizer, there are | 90 // Per https://www.chromium.org/developers/testing/addresssanitizer, there are |
90 // ASAN bots that run without the sandbox which this test will pass for. The | 91 // ASAN bots that run without the sandbox which this test will pass for. The |
91 // other ones pipe the output to a symbolizer script. | 92 // other ones pipe the output to a symbolizer script. |
92 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoSandbox)) { | 93 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoSandbox)) { |
93 new_test.AppendSwitch(switches::kNoSandbox); | 94 new_test.AppendSwitch(switches::kNoSandbox); |
94 } else { | 95 } else { |
| 96 #if defined(ADDRESS_SANITIZER) |
95 LOG(INFO) << "Couldn't run ContentBrowserTest.RendererCrashCallStack since " | 97 LOG(INFO) << "Couldn't run ContentBrowserTest.RendererCrashCallStack since " |
96 << "sandbox is enabled and ASAN requires piping to an external " | 98 << "sandbox is enabled and ASAN requires piping to an external " |
97 << "script."; | 99 << "script."; |
98 return; | 100 return; |
| 101 #endif |
99 } | 102 } |
100 #endif | |
101 | 103 |
102 std::string output; | 104 std::string output; |
103 base::GetAppOutputAndError(new_test, &output); | 105 base::GetAppOutputAndError(new_test, &output); |
104 | 106 |
105 std::string crash_string = | 107 std::string crash_string = |
106 "content::RenderFrameImpl::PrepareRenderViewForNavigation"; | 108 "content::RenderFrameImpl::PrepareRenderViewForNavigation"; |
107 | 109 |
108 if (output.find(crash_string) == std::string::npos) { | 110 if (output.find(crash_string) == std::string::npos) { |
109 GTEST_FAIL() << "Couldn't find\n" << crash_string << "\n in output\n " | 111 GTEST_FAIL() << "Couldn't find\n" << crash_string << "\n in output\n " |
110 << output; | 112 << output; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 179 |
178 IN_PROC_BROWSER_TEST_F(ContentBrowserTest, NonNestableTask) { | 180 IN_PROC_BROWSER_TEST_F(ContentBrowserTest, NonNestableTask) { |
179 bool non_nested_task_ran = false; | 181 bool non_nested_task_ran = false; |
180 base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask( | 182 base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask( |
181 FROM_HERE, base::Bind(&CallbackChecker, &non_nested_task_ran)); | 183 FROM_HERE, base::Bind(&CallbackChecker, &non_nested_task_ran)); |
182 content::RunAllPendingInMessageLoop(); | 184 content::RunAllPendingInMessageLoop(); |
183 ASSERT_TRUE(non_nested_task_ran); | 185 ASSERT_TRUE(non_nested_task_ran); |
184 } | 186 } |
185 | 187 |
186 } // namespace content | 188 } // namespace content |
OLD | NEW |