| OLD | NEW |
| 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 "components/test_runner/test_runner_for_specific_view.h" | 5 #include "components/test_runner/test_runner_for_specific_view.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 | 594 |
| 595 v8::Local<v8::Value> | 595 v8::Local<v8::Value> |
| 596 TestRunnerForSpecificView::EvaluateScriptInIsolatedWorldAndReturnValue( | 596 TestRunnerForSpecificView::EvaluateScriptInIsolatedWorldAndReturnValue( |
| 597 int world_id, | 597 int world_id, |
| 598 const std::string& script) { | 598 const std::string& script) { |
| 599 WebVector<v8::Local<v8::Value>> values; | 599 WebVector<v8::Local<v8::Value>> values; |
| 600 WebScriptSource source(WebString::fromUTF8(script)); | 600 WebScriptSource source(WebString::fromUTF8(script)); |
| 601 // This relies on the iframe focusing itself when it loads. This is a bit | 601 // This relies on the iframe focusing itself when it loads. This is a bit |
| 602 // sketchy, but it seems to be what other tests do. | 602 // sketchy, but it seems to be what other tests do. |
| 603 web_view()->focusedFrame()->executeScriptInIsolatedWorld(world_id, &source, 1, | 603 web_view()->focusedFrame()->executeScriptInIsolatedWorld(world_id, &source, 1, |
| 604 1, &values); | 604 &values); |
| 605 // Since only one script was added, only one result is expected | 605 // Since only one script was added, only one result is expected |
| 606 if (values.size() == 1 && !values[0].IsEmpty()) | 606 if (values.size() == 1 && !values[0].IsEmpty()) |
| 607 return values[0]; | 607 return values[0]; |
| 608 return v8::Local<v8::Value>(); | 608 return v8::Local<v8::Value>(); |
| 609 } | 609 } |
| 610 | 610 |
| 611 void TestRunnerForSpecificView::EvaluateScriptInIsolatedWorld( | 611 void TestRunnerForSpecificView::EvaluateScriptInIsolatedWorld( |
| 612 int world_id, | 612 int world_id, |
| 613 const std::string& script) { | 613 const std::string& script) { |
| 614 WebScriptSource source(WebString::fromUTF8(script)); | 614 WebScriptSource source(WebString::fromUTF8(script)); |
| 615 web_view()->focusedFrame()->executeScriptInIsolatedWorld(world_id, &source, 1, | 615 web_view()->focusedFrame()->executeScriptInIsolatedWorld(world_id, &source, |
| 616 1); | 616 1); |
| 617 } | 617 } |
| 618 | 618 |
| 619 void TestRunnerForSpecificView::SetIsolatedWorldSecurityOrigin( | 619 void TestRunnerForSpecificView::SetIsolatedWorldSecurityOrigin( |
| 620 int world_id, | 620 int world_id, |
| 621 v8::Local<v8::Value> origin) { | 621 v8::Local<v8::Value> origin) { |
| 622 if (!(origin->IsString() || !origin->IsNull())) | 622 if (!(origin->IsString() || !origin->IsNull())) |
| 623 return; | 623 return; |
| 624 | 624 |
| 625 WebSecurityOrigin web_origin; | 625 WebSecurityOrigin web_origin; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 | 691 |
| 692 blink::WebView* TestRunnerForSpecificView::web_view() { | 692 blink::WebView* TestRunnerForSpecificView::web_view() { |
| 693 return web_view_test_proxy_base_->web_view(); | 693 return web_view_test_proxy_base_->web_view(); |
| 694 } | 694 } |
| 695 | 695 |
| 696 WebTestDelegate* TestRunnerForSpecificView::delegate() { | 696 WebTestDelegate* TestRunnerForSpecificView::delegate() { |
| 697 return web_view_test_proxy_base_->delegate(); | 697 return web_view_test_proxy_base_->delegate(); |
| 698 } | 698 } |
| 699 | 699 |
| 700 } // namespace test_runner | 700 } // namespace test_runner |
| OLD | NEW |