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

Side by Side Diff: components/test_runner/web_test_proxy.cc

Issue 1787743003: Remove unneeded code from WebTestProxyBase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing accidental reversal of condition in RunModalBeforeUnloadDialog. 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 | « components/test_runner/web_test_proxy.h ('k') | components/test_runner/web_test_runner.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/test_runner/web_test_proxy.h" 5 #include "components/test_runner/web_test_proxy.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <cctype> 10 #include <cctype>
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 std::string result; 295 std::string result;
296 const std::vector<WebTestProxyBase*>& window_list = 296 const std::vector<WebTestProxyBase*>& window_list =
297 interfaces->GetWindowList(); 297 interfaces->GetWindowList();
298 for (size_t i = 0; i < window_list.size(); ++i) 298 for (size_t i = 0; i < window_list.size(); ++i)
299 result.append(delegate->DumpHistoryForWindow(window_list.at(i))); 299 result.append(delegate->DumpHistoryForWindow(window_list.at(i)));
300 return result; 300 return result;
301 } 301 }
302 } 302 }
303 303
304 WebTestProxyBase::WebTestProxyBase() 304 WebTestProxyBase::WebTestProxyBase()
305 : web_test_interfaces_(NULL), 305 : test_interfaces_(NULL),
306 test_interfaces_(NULL),
307 delegate_(NULL), 306 delegate_(NULL),
308 web_widget_(NULL), 307 web_widget_(NULL),
309 spellcheck_(new SpellCheckClient(this)), 308 spellcheck_(new SpellCheckClient(this)),
310 chooser_count_(0) { 309 chooser_count_(0) {
311 Reset(); 310 Reset();
312 } 311 }
313 312
314 WebTestProxyBase::~WebTestProxyBase() { 313 WebTestProxyBase::~WebTestProxyBase() {
315 test_interfaces_->WindowClosed(this); 314 test_interfaces_->WindowClosed(this);
316 delegate_->OnWebTestProxyBaseDestroy(this);
317 } 315 }
318 316
319 void WebTestProxyBase::SetInterfaces(WebTestInterfaces* interfaces) { 317 void WebTestProxyBase::SetInterfaces(WebTestInterfaces* interfaces) {
320 web_test_interfaces_ = interfaces;
321 test_interfaces_ = interfaces->GetTestInterfaces(); 318 test_interfaces_ = interfaces->GetTestInterfaces();
322 test_interfaces_->WindowOpened(this); 319 test_interfaces_->WindowOpened(this);
323 } 320 }
324 321
325 WebTestInterfaces* WebTestProxyBase::GetInterfaces() {
326 return web_test_interfaces_;
327 }
328
329 void WebTestProxyBase::SetDelegate(WebTestDelegate* delegate) { 322 void WebTestProxyBase::SetDelegate(WebTestDelegate* delegate) {
330 delegate_ = delegate; 323 delegate_ = delegate;
331 spellcheck_->SetDelegate(delegate); 324 spellcheck_->SetDelegate(delegate);
332 if (speech_recognizer_.get()) 325 if (speech_recognizer_.get())
333 speech_recognizer_->SetDelegate(delegate); 326 speech_recognizer_->SetDelegate(delegate);
334 } 327 }
335 328
336 WebTestDelegate* WebTestProxyBase::GetDelegate() {
337 return delegate_;
338 }
339
340 blink::WebView* WebTestProxyBase::GetWebView() const { 329 blink::WebView* WebTestProxyBase::GetWebView() const {
341 DCHECK(web_widget_); 330 DCHECK(web_widget_);
342 // TestRunner does not support popup widgets. So |web_widget|_ is always a 331 // TestRunner does not support popup widgets. So |web_widget|_ is always a
343 // WebView. 332 // WebView.
344 return static_cast<blink::WebView*>(web_widget_); 333 return static_cast<blink::WebView*>(web_widget_);
345 } 334 }
346 335
347 void WebTestProxyBase::Reset() { 336 void WebTestProxyBase::Reset() {
348 drag_image_.reset(); 337 drag_image_.reset();
349 animate_scheduled_ = false; 338 animate_scheduled_ = false;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 } else if (sub_message_hint == blink::WebTextDirectionRightToLeft) { 384 } else if (sub_message_hint == blink::WebTextDirectionRightToLeft) {
396 base::i18n::WrapStringWithRTLFormatting(&wrapped_sub_text); 385 base::i18n::WrapStringWithRTLFormatting(&wrapped_sub_text);
397 } 386 }
398 } 387 }
399 delegate_->PrintMessage("ValidationMessageClient: main-message=" + 388 delegate_->PrintMessage("ValidationMessageClient: main-message=" +
400 base::UTF16ToUTF8(wrapped_main_text) + 389 base::UTF16ToUTF8(wrapped_main_text) +
401 " sub-message=" + 390 " sub-message=" +
402 base::UTF16ToUTF8(wrapped_sub_text) + "\n"); 391 base::UTF16ToUTF8(wrapped_sub_text) + "\n");
403 } 392 }
404 393
394 void WebTestProxyBase::RunModalAlertDialog(const blink::WebString& message) {
395 delegate_->PrintMessage(std::string("ALERT: ") + message.utf8().data() +
396 "\n");
397 }
398
399 bool WebTestProxyBase::RunModalConfirmDialog(const blink::WebString& message) {
400 delegate_->PrintMessage(std::string("CONFIRM: ") + message.utf8().data() +
401 "\n");
402 return true;
403 }
404
405 bool WebTestProxyBase::RunModalPromptDialog(
406 const blink::WebString& message,
407 const blink::WebString& default_value,
408 blink::WebString* actual_value) {
409 delegate_->PrintMessage(std::string("PROMPT: ") + message.utf8().data() +
410 ", default text: " + default_value.utf8().data() +
411 "\n");
412 return true;
413 }
414
415 bool WebTestProxyBase::RunModalBeforeUnloadDialog(bool is_reload) {
416 delegate_->PrintMessage(std::string("CONFIRM NAVIGATION\n"));
417 return !test_interfaces_->GetTestRunner()
418 ->shouldStayOnPageAfterHandlingBeforeUnload();
419 }
420
405 std::string WebTestProxyBase::DumpBackForwardLists() { 421 std::string WebTestProxyBase::DumpBackForwardLists() {
406 return DumpAllBackForwardLists(test_interfaces_, delegate_); 422 return DumpAllBackForwardLists(test_interfaces_, delegate_);
407 } 423 }
408 424
409 void WebTestProxyBase::DrawSelectionRect(SkCanvas* canvas) { 425 void WebTestProxyBase::DrawSelectionRect(SkCanvas* canvas) {
410 // See if we need to draw the selection bounds rect. Selection bounds 426 // See if we need to draw the selection bounds rect. Selection bounds
411 // rect is the rect enclosing the (possibly transformed) selection. 427 // rect is the rect enclosing the (possibly transformed) selection.
412 // The rect should be drawn after everything is laid out and painted. 428 // The rect should be drawn after everything is laid out and painted.
413 if (!test_interfaces_->GetTestRunner()->shouldDumpSelectionRect()) 429 if (!test_interfaces_->GetTestRunner()->shouldDumpSelectionRect())
414 return; 430 return;
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 callback->onError(blink::WebSetSinkIdError::NotAuthorized); 1312 callback->onError(blink::WebSetSinkIdError::NotAuthorized);
1297 else 1313 else
1298 callback->onError(blink::WebSetSinkIdError::NotFound); 1314 callback->onError(blink::WebSetSinkIdError::NotFound);
1299 } 1315 }
1300 1316
1301 blink::WebString WebTestProxyBase::acceptLanguages() { 1317 blink::WebString WebTestProxyBase::acceptLanguages() {
1302 return blink::WebString::fromUTF8(accept_languages_); 1318 return blink::WebString::fromUTF8(accept_languages_);
1303 } 1319 }
1304 1320
1305 } // namespace test_runner 1321 } // namespace test_runner
OLDNEW
« no previous file with comments | « components/test_runner/web_test_proxy.h ('k') | components/test_runner/web_test_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698