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

Side by Side Diff: content/public/test/content_browser_test.cc

Issue 1763113002: Move layout-test-specific switches from shell_switches to layout_test_switches.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-line-box-and-debug-from-flags-struct
Patch Set: Fix accidental condition reversal in Shell::ToggleFullscreenModeForTab. Created 4 years, 9 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/content_shell.gypi ('k') | content/shell/BUILD.gn » ('j') | 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/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 SetUpCommandLine(command_line); 59 SetUpCommandLine(command_line);
60 60
61 #if defined(OS_ANDROID) 61 #if defined(OS_ANDROID)
62 shell_main_delegate_.reset(new ShellMainDelegate); 62 shell_main_delegate_.reset(new ShellMainDelegate);
63 shell_main_delegate_->PreSandboxStartup(); 63 shell_main_delegate_->PreSandboxStartup();
64 if (command_line->HasSwitch(switches::kSingleProcess)) { 64 if (command_line->HasSwitch(switches::kSingleProcess)) {
65 // We explicitly leak the new ContentRendererClient as we're 65 // We explicitly leak the new ContentRendererClient as we're
66 // setting a global that may be used after ContentBrowserTest is 66 // setting a global that may be used after ContentBrowserTest is
67 // destroyed. 67 // destroyed.
68 ContentRendererClient* old_client = 68 ContentRendererClient* old_client =
69 command_line->HasSwitch(switches::kRunLayoutTest) 69 switches::IsRunLayoutTestSwitchPresent()
70 ? SetRendererClientForTesting(new LayoutTestContentRendererClient) 70 ? SetRendererClientForTesting(new LayoutTestContentRendererClient)
71 : SetRendererClientForTesting(new ShellContentRendererClient); 71 : SetRendererClientForTesting(new ShellContentRendererClient);
72 // No-one should have set this value before we did. 72 // No-one should have set this value before we did.
73 DCHECK(!old_client); 73 DCHECK(!old_client);
74 } 74 }
75 #elif defined(OS_MACOSX) 75 #elif defined(OS_MACOSX)
76 // See InProcessBrowserTest::PrepareTestCommandLine(). 76 // See InProcessBrowserTest::PrepareTestCommandLine().
77 base::FilePath subprocess_path; 77 base::FilePath subprocess_path;
78 PathService::Get(base::FILE_EXE, &subprocess_path); 78 PathService::Get(base::FILE_EXE, &subprocess_path);
79 subprocess_path = subprocess_path.DirName().DirName(); 79 subprocess_path = subprocess_path.DirName().DirName();
(...skipping 19 matching lines...) Expand all
99 #if !defined(OS_CHROMEOS) && defined(OS_LINUX) 99 #if !defined(OS_CHROMEOS) && defined(OS_LINUX)
100 ui::ShutdownInputMethodForTesting(); 100 ui::ShutdownInputMethodForTesting();
101 #endif 101 #endif
102 102
103 #if defined(OS_ANDROID) 103 #if defined(OS_ANDROID)
104 shell_main_delegate_.reset(); 104 shell_main_delegate_.reset();
105 #endif 105 #endif
106 } 106 }
107 107
108 void ContentBrowserTest::RunTestOnMainThreadLoop() { 108 void ContentBrowserTest::RunTestOnMainThreadLoop() {
109 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 109 if (!switches::IsRunLayoutTestSwitchPresent()) {
110 switches::kRunLayoutTest)) {
111 CHECK_EQ(Shell::windows().size(), 1u); 110 CHECK_EQ(Shell::windows().size(), 1u);
112 shell_ = Shell::windows()[0]; 111 shell_ = Shell::windows()[0];
113 } 112 }
114 113
115 #if defined(OS_MACOSX) 114 #if defined(OS_MACOSX)
116 // On Mac, without the following autorelease pool, code which is directly 115 // On Mac, without the following autorelease pool, code which is directly
117 // executed (as opposed to executed inside a message loop) would autorelease 116 // executed (as opposed to executed inside a message loop) would autorelease
118 // objects into a higher-level pool. This pool is not recycled in-sync with 117 // objects into a higher-level pool. This pool is not recycled in-sync with
119 // the message loops' pools and causes problems with code relying on 118 // the message loops' pools and causes problems with code relying on
120 // deallocation via an autorelease pool (such as browser window closure and 119 // deallocation via an autorelease pool (such as browser window closure and
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 156
158 Shell* ContentBrowserTest::CreateOffTheRecordBrowser() { 157 Shell* ContentBrowserTest::CreateOffTheRecordBrowser() {
159 return Shell::CreateNewWindow( 158 return Shell::CreateNewWindow(
160 ShellContentBrowserClient::Get()->off_the_record_browser_context(), 159 ShellContentBrowserClient::Get()->off_the_record_browser_context(),
161 GURL(url::kAboutBlankURL), 160 GURL(url::kAboutBlankURL),
162 NULL, 161 NULL,
163 gfx::Size()); 162 gfx::Size());
164 } 163 }
165 164
166 } // namespace content 165 } // namespace content
OLDNEW
« no previous file with comments | « content/content_shell.gypi ('k') | content/shell/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698