OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
| 8 #include "base/command_line.h" |
8 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "content/public/common/content_switches.h" |
9 #include "content/public/test/browser_test_utils.h" | 11 #include "content/public/test/browser_test_utils.h" |
10 #include "content/public/test/content_browser_test.h" | 12 #include "content/public/test/content_browser_test.h" |
11 #include "content/public/test/content_browser_test_utils.h" | 13 #include "content/public/test/content_browser_test_utils.h" |
12 #include "content/shell/browser/shell.h" | 14 #include "content/shell/browser/shell.h" |
13 | 15 |
14 namespace content { | 16 namespace content { |
15 | 17 |
16 class LinuxZygoteBrowserTest : public ContentBrowserTest { | 18 class LinuxZygoteBrowserTest : public ContentBrowserTest { |
17 public: | 19 public: |
18 LinuxZygoteBrowserTest() {} | 20 LinuxZygoteBrowserTest() {} |
(...skipping 12 matching lines...) Expand all Loading... |
31 std::string result; | 33 std::string result; |
32 ASSERT_TRUE(ExecuteScriptAndExtractString(shell(), kTestCommand, &result)); | 34 ASSERT_TRUE(ExecuteScriptAndExtractString(shell(), kTestCommand, &result)); |
33 std::vector<std::string> parts = base::SplitString( | 35 std::vector<std::string> parts = base::SplitString( |
34 result, "()", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); | 36 result, "()", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); |
35 ASSERT_EQ(3U, parts.size()); | 37 ASSERT_EQ(3U, parts.size()); |
36 EXPECT_FALSE(parts[0].empty()); | 38 EXPECT_FALSE(parts[0].empty()); |
37 EXPECT_FALSE(parts[1].empty()); | 39 EXPECT_FALSE(parts[1].empty()); |
38 EXPECT_TRUE(parts[2].empty()); | 40 EXPECT_TRUE(parts[2].empty()); |
39 } | 41 } |
40 | 42 |
| 43 class LinuxZygoteDisabledBrowserTest : public ContentBrowserTest { |
| 44 public: |
| 45 LinuxZygoteDisabledBrowserTest() {} |
| 46 ~LinuxZygoteDisabledBrowserTest() override {} |
| 47 |
| 48 protected: |
| 49 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 50 ContentBrowserTest::SetUpCommandLine(command_line); |
| 51 command_line->AppendSwitch(switches::kNoZygote); |
| 52 command_line->AppendSwitch(switches::kNoSandbox); |
| 53 } |
| 54 |
| 55 private: |
| 56 DISALLOW_COPY_AND_ASSIGN(LinuxZygoteDisabledBrowserTest); |
| 57 }; |
| 58 |
| 59 // https://crbug.com/712779 |
| 60 #if !defined(THREAD_SANITIZER) |
| 61 // Test that the renderer doesn't crash during launch if zygote is disabled. |
| 62 IN_PROC_BROWSER_TEST_F(LinuxZygoteDisabledBrowserTest, |
| 63 NoCrashWhenZygoteDisabled) { |
| 64 NavigateToURL(shell(), GURL("data:text/html,start page")); |
| 65 } |
| 66 #endif |
| 67 |
41 } // namespace content | 68 } // namespace content |
OLD | NEW |