| OLD | NEW |
| 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 <cctype> | 7 #include <cctype> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 std::string result; | 372 std::string result; |
| 373 const std::vector<WebTestProxyBase*>& window_list = | 373 const std::vector<WebTestProxyBase*>& window_list = |
| 374 interfaces->GetWindowList(); | 374 interfaces->GetWindowList(); |
| 375 for (size_t i = 0; i < window_list.size(); ++i) | 375 for (size_t i = 0; i < window_list.size(); ++i) |
| 376 result.append(delegate->DumpHistoryForWindow(window_list.at(i))); | 376 result.append(delegate->DumpHistoryForWindow(window_list.at(i))); |
| 377 return result; | 377 return result; |
| 378 } | 378 } |
| 379 } | 379 } |
| 380 | 380 |
| 381 WebTestProxyBase::WebTestProxyBase() | 381 WebTestProxyBase::WebTestProxyBase() |
| 382 : test_interfaces_(NULL), | 382 : web_test_interfaces_(NULL), |
| 383 test_interfaces_(NULL), |
| 383 delegate_(NULL), | 384 delegate_(NULL), |
| 384 web_widget_(NULL), | 385 web_widget_(NULL), |
| 385 spellcheck_(new SpellCheckClient(this)), | 386 spellcheck_(new SpellCheckClient(this)), |
| 386 chooser_count_(0) { | 387 chooser_count_(0) { |
| 387 Reset(); | 388 Reset(); |
| 388 } | 389 } |
| 389 | 390 |
| 390 WebTestProxyBase::~WebTestProxyBase() { | 391 WebTestProxyBase::~WebTestProxyBase() { |
| 391 test_interfaces_->WindowClosed(this); | 392 test_interfaces_->WindowClosed(this); |
| 392 } | 393 } |
| 393 | 394 |
| 394 void WebTestProxyBase::SetInterfaces(WebTestInterfaces* interfaces) { | 395 void WebTestProxyBase::SetInterfaces(WebTestInterfaces* interfaces) { |
| 396 web_test_interfaces_ = interfaces; |
| 395 test_interfaces_ = interfaces->GetTestInterfaces(); | 397 test_interfaces_ = interfaces->GetTestInterfaces(); |
| 396 test_interfaces_->WindowOpened(this); | 398 test_interfaces_->WindowOpened(this); |
| 397 } | 399 } |
| 398 | 400 |
| 401 WebTestInterfaces* WebTestProxyBase::GetInterfaces() { |
| 402 return web_test_interfaces_; |
| 403 } |
| 404 |
| 399 void WebTestProxyBase::SetDelegate(WebTestDelegate* delegate) { | 405 void WebTestProxyBase::SetDelegate(WebTestDelegate* delegate) { |
| 400 delegate_ = delegate; | 406 delegate_ = delegate; |
| 401 spellcheck_->SetDelegate(delegate); | 407 spellcheck_->SetDelegate(delegate); |
| 402 if (speech_recognizer_.get()) | 408 if (speech_recognizer_.get()) |
| 403 speech_recognizer_->SetDelegate(delegate); | 409 speech_recognizer_->SetDelegate(delegate); |
| 404 } | 410 } |
| 405 | 411 |
| 412 WebTestDelegate* WebTestProxyBase::GetDelegate() { |
| 413 return delegate_; |
| 414 } |
| 415 |
| 406 blink::WebView* WebTestProxyBase::GetWebView() const { | 416 blink::WebView* WebTestProxyBase::GetWebView() const { |
| 407 DCHECK(web_widget_); | 417 DCHECK(web_widget_); |
| 408 // TestRunner does not support popup widgets. So |web_widget|_ is always a | 418 // TestRunner does not support popup widgets. So |web_widget|_ is always a |
| 409 // WebView. | 419 // WebView. |
| 410 return static_cast<blink::WebView*>(web_widget_); | 420 return static_cast<blink::WebView*>(web_widget_); |
| 411 } | 421 } |
| 412 | 422 |
| 413 void WebTestProxyBase::Reset() { | 423 void WebTestProxyBase::Reset() { |
| 414 drag_image_.reset(); | 424 drag_image_.reset(); |
| 415 animate_scheduled_ = false; | 425 animate_scheduled_ = false; |
| (...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1387 // to cancel the input method's ongoing composition session. | 1397 // to cancel the input method's ongoing composition session. |
| 1388 if (web_widget_) | 1398 if (web_widget_) |
| 1389 web_widget_->confirmComposition(); | 1399 web_widget_->confirmComposition(); |
| 1390 } | 1400 } |
| 1391 | 1401 |
| 1392 blink::WebString WebTestProxyBase::acceptLanguages() { | 1402 blink::WebString WebTestProxyBase::acceptLanguages() { |
| 1393 return blink::WebString::fromUTF8(accept_languages_); | 1403 return blink::WebString::fromUTF8(accept_languages_); |
| 1394 } | 1404 } |
| 1395 | 1405 |
| 1396 } // namespace test_runner | 1406 } // namespace test_runner |
| OLD | NEW |