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

Side by Side Diff: headless/app/headless_shell.cc

Issue 2561963002: base: Remove the string logging from CHECK(). (Closed)
Patch Set: checkstring: rebase Created 4 years 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
OLDNEW
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 <iostream> 5 #include <iostream>
6 #include <memory> 6 #include <memory>
7 #include <string> 7 #include <string>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // attached. 147 // attached.
148 148
149 devtools_client_->GetEmulation()->GetExperimental()->AddObserver(this); 149 devtools_client_->GetEmulation()->GetExperimental()->AddObserver(this);
150 150
151 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 151 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
152 switches::kVirtualTimeBudget)) { 152 switches::kVirtualTimeBudget)) {
153 std::string budget_ms_ascii = 153 std::string budget_ms_ascii =
154 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 154 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
155 switches::kVirtualTimeBudget); 155 switches::kVirtualTimeBudget);
156 int budget_ms; 156 int budget_ms;
157 CHECK(base::StringToInt(budget_ms_ascii, &budget_ms)) 157 // Expected an integer value for --virtual-time-budget=
158 << "Expected an integer value for --virtual-time-budget="; 158 CHECK(base::StringToInt(budget_ms_ascii, &budget_ms));
159 devtools_client_->GetEmulation()->GetExperimental()->SetVirtualTimePolicy( 159 devtools_client_->GetEmulation()->GetExperimental()->SetVirtualTimePolicy(
160 emulation::SetVirtualTimePolicyParams::Builder() 160 emulation::SetVirtualTimePolicyParams::Builder()
161 .SetPolicy(emulation::VirtualTimePolicy:: 161 .SetPolicy(emulation::VirtualTimePolicy::
162 PAUSE_IF_NETWORK_FETCHES_PENDING) 162 PAUSE_IF_NETWORK_FETCHES_PENDING)
163 .SetBudget(budget_ms) 163 .SetBudget(budget_ms)
164 .Build()); 164 .Build());
165 } else { 165 } else {
166 PollReadyState(); 166 PollReadyState();
167 } 167 }
168 168
169 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTimeout)) { 169 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTimeout)) {
170 std::string timeout_ms_ascii = 170 std::string timeout_ms_ascii =
171 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 171 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
172 switches::kTimeout); 172 switches::kTimeout);
173 int timeout_ms; 173 int timeout_ms;
174 CHECK(base::StringToInt(timeout_ms_ascii, &timeout_ms)) 174 // Expected an integer value for --timeout=
175 << "Expected an integer value for --timeout="; 175 CHECK(base::StringToInt(timeout_ms_ascii, &timeout_ms));
176 browser_->BrowserMainThread()->PostDelayedTask( 176 browser_->BrowserMainThread()->PostDelayedTask(
177 FROM_HERE, 177 FROM_HERE,
178 base::Bind(&HeadlessShell::FetchTimeout, weak_factory_.GetWeakPtr()), 178 base::Bind(&HeadlessShell::FetchTimeout, weak_factory_.GetWeakPtr()),
179 base::TimeDelta::FromMilliseconds(timeout_ms)); 179 base::TimeDelta::FromMilliseconds(timeout_ms));
180 } 180 }
181 181
182 // TODO(skyostil): Implement more features to demonstrate the devtools API. 182 // TODO(skyostil): Implement more features to demonstrate the devtools API.
183 } 183 }
184 184
185 void FetchTimeout() { 185 void FetchTimeout() {
186 LOG(INFO) << "Timeout.";
187 devtools_client_->GetPage()->GetExperimental()->StopLoading( 186 devtools_client_->GetPage()->GetExperimental()->StopLoading(
188 page::StopLoadingParams::Builder().Build()); 187 page::StopLoadingParams::Builder().Build());
189 } 188 }
190 189
191 void OnTargetCrashed(const inspector::TargetCrashedParams& params) override { 190 void OnTargetCrashed(const inspector::TargetCrashedParams& params) override {
192 LOG(ERROR) << "Abnormal renderer termination."; 191 LOG(ERROR) << "Abnormal renderer termination.";
193 // NB this never gets called if remote debugging is enabled. 192 // NB this never gets called if remote debugging is enabled.
194 Shutdown(); 193 Shutdown();
195 } 194 }
196 195
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 } 464 }
466 builder.SetWindowSize(parsed_window_size); 465 builder.SetWindowSize(parsed_window_size);
467 } 466 }
468 467
469 return HeadlessBrowserMain( 468 return HeadlessBrowserMain(
470 builder.Build(), 469 builder.Build(),
471 base::Bind(&HeadlessShell::OnStart, base::Unretained(&shell))); 470 base::Bind(&HeadlessShell::OnStart, base::Unretained(&shell)));
472 } 471 }
473 472
474 } // namespace headless 473 } // namespace headless
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698