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

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

Issue 803813003: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 12 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/public/test/browser_test_base.cc ('k') | content/public/test/render_view_test.cc » ('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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 content_test_data_absolute.Append(content_test_data); 54 content_test_data_absolute.Append(content_test_data);
55 embedded_test_server()->ServeFilesFromDirectory(content_test_data_absolute); 55 embedded_test_server()->ServeFilesFromDirectory(content_test_data_absolute);
56 } 56 }
57 57
58 ContentBrowserTest::~ContentBrowserTest() { 58 ContentBrowserTest::~ContentBrowserTest() {
59 CHECK(setup_called_) << "Overridden SetUp() did not call parent " 59 CHECK(setup_called_) << "Overridden SetUp() did not call parent "
60 "implementation, so test not run."; 60 "implementation, so test not run.";
61 } 61 }
62 62
63 void ContentBrowserTest::SetUp() { 63 void ContentBrowserTest::SetUp() {
64 CommandLine* command_line = CommandLine::ForCurrentProcess(); 64 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
65 command_line->AppendSwitch(switches::kContentBrowserTest); 65 command_line->AppendSwitch(switches::kContentBrowserTest);
66 66
67 SetUpCommandLine(command_line); 67 SetUpCommandLine(command_line);
68 68
69 #if defined(OS_ANDROID) 69 #if defined(OS_ANDROID)
70 shell_main_delegate_.reset(new ShellMainDelegate); 70 shell_main_delegate_.reset(new ShellMainDelegate);
71 shell_main_delegate_->PreSandboxStartup(); 71 shell_main_delegate_->PreSandboxStartup();
72 if (command_line->HasSwitch(switches::kSingleProcess)) { 72 if (command_line->HasSwitch(switches::kSingleProcess)) {
73 // We explicitly leak the new ContentRendererClient as we're 73 // We explicitly leak the new ContentRendererClient as we're
74 // setting a global that may be used after ContentBrowserTest is 74 // setting a global that may be used after ContentBrowserTest is
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 #if !defined(OS_CHROMEOS) && defined(OS_LINUX) 109 #if !defined(OS_CHROMEOS) && defined(OS_LINUX)
110 ui::ShutdownInputMethodForTesting(); 110 ui::ShutdownInputMethodForTesting();
111 #endif 111 #endif
112 112
113 #if defined(OS_ANDROID) 113 #if defined(OS_ANDROID)
114 shell_main_delegate_.reset(); 114 shell_main_delegate_.reset();
115 #endif 115 #endif
116 } 116 }
117 117
118 void ContentBrowserTest::RunTestOnMainThreadLoop() { 118 void ContentBrowserTest::RunTestOnMainThreadLoop() {
119 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { 119 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
120 switches::kDumpRenderTree)) {
120 CHECK_EQ(Shell::windows().size(), 1u); 121 CHECK_EQ(Shell::windows().size(), 1u);
121 shell_ = Shell::windows()[0]; 122 shell_ = Shell::windows()[0];
122 } 123 }
123 124
124 #if defined(OS_MACOSX) 125 #if defined(OS_MACOSX)
125 // On Mac, without the following autorelease pool, code which is directly 126 // On Mac, without the following autorelease pool, code which is directly
126 // executed (as opposed to executed inside a message loop) would autorelease 127 // executed (as opposed to executed inside a message loop) would autorelease
127 // objects into a higher-level pool. This pool is not recycled in-sync with 128 // objects into a higher-level pool. This pool is not recycled in-sync with
128 // the message loops' pools and causes problems with code relying on 129 // the message loops' pools and causes problems with code relying on
129 // deallocation via an autorelease pool (such as browser window closure and 130 // deallocation via an autorelease pool (such as browser window closure and
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 167
167 Shell* ContentBrowserTest::CreateOffTheRecordBrowser() { 168 Shell* ContentBrowserTest::CreateOffTheRecordBrowser() {
168 return Shell::CreateNewWindow( 169 return Shell::CreateNewWindow(
169 ShellContentBrowserClient::Get()->off_the_record_browser_context(), 170 ShellContentBrowserClient::Get()->off_the_record_browser_context(),
170 GURL(url::kAboutBlankURL), 171 GURL(url::kAboutBlankURL),
171 NULL, 172 NULL,
172 gfx::Size()); 173 gfx::Size());
173 } 174 }
174 175
175 } // namespace content 176 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/browser_test_base.cc ('k') | content/public/test/render_view_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698