Commit 7beb7f2e authored by Nicholas Verne's avatar Nicholas Verne Committed by Commit Bot

Move more web/tests

In order to move WebFrameTest we allow gfx::ScrollOffset
to be used from core/.

Bug: 712963
Change-Id: I8234af1f7fed70947c278f759b710053034368d9
Reviewed-on: https://chromium-review.googlesource.com/595021
Commit-Queue: Nicholas Verne <nverne@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491189}
parent 9070b9c5
...@@ -198,7 +198,7 @@ def _CheckForForbiddenNamespace(input_api, output_api): ...@@ -198,7 +198,7 @@ def _CheckForForbiddenNamespace(input_api, output_api):
# This list is not exhaustive, but covers likely ones. # This list is not exhaustive, but covers likely ones.
chromium_namespaces = ["base", "cc", "content", "gfx", "net", "ui"] chromium_namespaces = ["base", "cc", "content", "gfx", "net", "ui"]
chromium_forbidden_classes = ["scoped_refptr"] chromium_forbidden_classes = ["scoped_refptr"]
chromium_allowed_classes = ["gfx::ColorSpace", "gfx::CubicBezier", "gfx::ICCProfile"] chromium_allowed_classes = ["gfx::ColorSpace", "gfx::CubicBezier", "gfx::ICCProfile", "gfx::ScrollOffset"]
def source_file_filter(path): def source_file_filter(path):
return input_api.FilterSourceFile(path, return input_api.FilterSourceFile(path,
......
...@@ -1353,7 +1353,9 @@ jumbo_source_set("unit_tests") { ...@@ -1353,7 +1353,9 @@ jumbo_source_set("unit_tests") {
"exported/WebDocumentTest.cpp", "exported/WebDocumentTest.cpp",
"exported/WebDragDataTest.cpp", "exported/WebDragDataTest.cpp",
"exported/WebElementTest.cpp", "exported/WebElementTest.cpp",
"exported/WebFrameSerializerSanitizationTest.cpp",
"exported/WebFrameSerializerTest.cpp", "exported/WebFrameSerializerTest.cpp",
"exported/WebFrameTest.cpp",
"exported/WebHelperPluginTest.cpp", "exported/WebHelperPluginTest.cpp",
"exported/WebMeaningfulLayoutsTest.cpp", "exported/WebMeaningfulLayoutsTest.cpp",
"exported/WebNodeTest.cpp", "exported/WebNodeTest.cpp",
...@@ -1463,6 +1465,7 @@ jumbo_source_set("unit_tests") { ...@@ -1463,6 +1465,7 @@ jumbo_source_set("unit_tests") {
"layout/LayoutBoxModelObjectTest.cpp", "layout/LayoutBoxModelObjectTest.cpp",
"layout/LayoutBoxTest.cpp", "layout/LayoutBoxTest.cpp",
"layout/LayoutEmbeddedContentTest.cpp", "layout/LayoutEmbeddedContentTest.cpp",
"layout/LayoutGeometryMapTest.cpp",
"layout/LayoutInlineTest.cpp", "layout/LayoutInlineTest.cpp",
"layout/LayoutMediaTest.cpp", "layout/LayoutMediaTest.cpp",
"layout/LayoutMultiColumnFlowThreadTest.cpp", "layout/LayoutMultiColumnFlowThreadTest.cpp",
......
...@@ -96,8 +96,6 @@ ...@@ -96,8 +96,6 @@
#include "core/testing/sim/SimDisplayItemList.h" #include "core/testing/sim/SimDisplayItemList.h"
#include "core/testing/sim/SimRequest.h" #include "core/testing/sim/SimRequest.h"
#include "core/testing/sim/SimTest.h" #include "core/testing/sim/SimTest.h"
#include "modules/mediastream/MediaStream.h"
#include "modules/mediastream/MediaStreamRegistry.h"
#include "platform/Cursor.h" #include "platform/Cursor.h"
#include "platform/DragImage.h" #include "platform/DragImage.h"
#include "platform/KeyboardCodes.h" #include "platform/KeyboardCodes.h"
...@@ -5014,9 +5012,10 @@ TEST_P(ParameterizedWebFrameTest, FindDetachFrameBeforeScopeStrings) { ...@@ -5014,9 +5012,10 @@ TEST_P(ParameterizedWebFrameTest, FindDetachFrameBeforeScopeStrings) {
WebString search_text = WebString::FromUTF8(kFindString); WebString search_text = WebString::FromUTF8(kFindString);
WebLocalFrameImpl* main_frame = web_view_helper.LocalMainFrame(); WebLocalFrameImpl* main_frame = web_view_helper.LocalMainFrame();
for (WebFrame* frame = main_frame; frame; frame = frame->TraverseNext()) for (WebFrame* frame = main_frame; frame; frame = frame->TraverseNext()) {
EXPECT_TRUE(frame->ToWebLocalFrame()->Find(kFindIdentifier, search_text, EXPECT_TRUE(frame->ToWebLocalFrame()->Find(kFindIdentifier, search_text,
options, false)); options, false));
}
RunPendingTasks(); RunPendingTasks();
EXPECT_FALSE(client.FindResultsAreReady()); EXPECT_FALSE(client.FindResultsAreReady());
...@@ -5053,9 +5052,10 @@ TEST_P(ParameterizedWebFrameTest, FindDetachFrameWhileScopingStrings) { ...@@ -5053,9 +5052,10 @@ TEST_P(ParameterizedWebFrameTest, FindDetachFrameWhileScopingStrings) {
WebString search_text = WebString::FromUTF8(kFindString); WebString search_text = WebString::FromUTF8(kFindString);
WebLocalFrameImpl* main_frame = web_view_helper.LocalMainFrame(); WebLocalFrameImpl* main_frame = web_view_helper.LocalMainFrame();
for (WebFrame* frame = main_frame; frame; frame = frame->TraverseNext()) for (WebFrame* frame = main_frame; frame; frame = frame->TraverseNext()) {
EXPECT_TRUE(frame->ToWebLocalFrame()->Find(kFindIdentifier, search_text, EXPECT_TRUE(frame->ToWebLocalFrame()->Find(kFindIdentifier, search_text,
options, false)); options, false));
}
RunPendingTasks(); RunPendingTasks();
EXPECT_FALSE(client.FindResultsAreReady()); EXPECT_FALSE(client.FindResultsAreReady());
...@@ -5096,9 +5096,10 @@ TEST_P(ParameterizedWebFrameTest, ResetMatchCount) { ...@@ -5096,9 +5096,10 @@ TEST_P(ParameterizedWebFrameTest, ResetMatchCount) {
// Check that child frame exists. // Check that child frame exists.
EXPECT_TRUE(!!main_frame->TraverseNext()); EXPECT_TRUE(!!main_frame->TraverseNext());
for (WebFrame* frame = main_frame; frame; frame = frame->TraverseNext()) for (WebFrame* frame = main_frame; frame; frame = frame->TraverseNext()) {
EXPECT_FALSE(frame->ToWebLocalFrame()->Find(kFindIdentifier, search_text, EXPECT_FALSE(frame->ToWebLocalFrame()->Find(kFindIdentifier, search_text,
options, false)); options, false));
}
RunPendingTasks(); RunPendingTasks();
EXPECT_FALSE(client.FindResultsAreReady()); EXPECT_FALSE(client.FindResultsAreReady());
...@@ -6077,11 +6078,12 @@ class CompositedSelectionBoundsTest : public ParameterizedWebFrameTest { ...@@ -6077,11 +6078,12 @@ class CompositedSelectionBoundsTest : public ParameterizedWebFrameTest {
// selection behavior. However, such deviations from the expected value // selection behavior. However, such deviations from the expected value
// should be consistent for the corresponding y coordinates. // should be consistent for the corresponding y coordinates.
int y_bottom_epsilon = 0; int y_bottom_epsilon = 0;
if (expected_result.Length() == 13) if (expected_result.Length() == 13) {
y_bottom_epsilon = expected_result.Get(context, 12) y_bottom_epsilon = expected_result.Get(context, 12)
.ToLocalChecked() .ToLocalChecked()
.As<v8::Int32>() .As<v8::Int32>()
->Value(); ->Value();
}
int y_bottom_deviation = int y_bottom_deviation =
start_edge_bottom_in_layer_y - select_start->edge_bottom_in_layer.y; start_edge_bottom_in_layer_y - select_start->edge_bottom_in_layer.y;
EXPECT_GE(y_bottom_epsilon, std::abs(y_bottom_deviation)); EXPECT_GE(y_bottom_epsilon, std::abs(y_bottom_deviation));
...@@ -6710,11 +6712,11 @@ TEST_P(ParameterizedWebFrameTest, RemoveSpellingMarkersUnderWords) { ...@@ -6710,11 +6712,11 @@ TEST_P(ParameterizedWebFrameTest, RemoveSpellingMarkersUnderWords) {
document->execCommand("InsertText", false, " wellcome ", exception_state); document->execCommand("InsertText", false, " wellcome ", exception_state);
EXPECT_FALSE(exception_state.HadException()); EXPECT_FALSE(exception_state.HadException());
if (RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) if (RuntimeEnabledFeatures::IdleTimeSpellCheckingEnabled()) {
frame->GetSpellChecker() frame->GetSpellChecker()
.GetIdleSpellCheckCallback() .GetIdleSpellCheckCallback()
.ForceInvocationForTesting(); .ForceInvocationForTesting();
}
WebVector<unsigned> offsets1; WebVector<unsigned> offsets1;
GetSpellingMarkerOffsets(&offsets1, *frame->GetDocument()); GetSpellingMarkerOffsets(&offsets1, *frame->GetDocument());
EXPECT_EQ(1U, offsets1.size()); EXPECT_EQ(1U, offsets1.size());
...@@ -6758,9 +6760,10 @@ class StubbornTextCheckClient : public WebTextCheckClient { ...@@ -6758,9 +6760,10 @@ class StubbornTextCheckClient : public WebTextCheckClient {
if (!completion_) if (!completion_)
return; return;
Vector<WebTextCheckingResult> results; Vector<WebTextCheckingResult> results;
if (misspelling_start_offset >= 0 && misspelling_length > 0) if (misspelling_start_offset >= 0 && misspelling_length > 0) {
results.push_back(WebTextCheckingResult(type, misspelling_start_offset, results.push_back(WebTextCheckingResult(type, misspelling_start_offset,
misspelling_length)); misspelling_length));
}
completion_->DidFinishCheckingText(results); completion_->DidFinishCheckingText(results);
completion_ = 0; completion_ = 0;
} }
...@@ -7022,8 +7025,8 @@ TEST_P(ParameterizedWebFrameTest, DidAccessInitialDocumentViaJavascriptUrl) { ...@@ -7022,8 +7025,8 @@ TEST_P(ParameterizedWebFrameTest, DidAccessInitialDocumentViaJavascriptUrl) {
web_view_helper.Reset(); web_view_helper.Reset();
} }
TEST_P(ParameterizedWebFrameTest, DidAccessInitialDocumentBodyBeforeModalDialog) TEST_P(ParameterizedWebFrameTest,
{ DidAccessInitialDocumentBodyBeforeModalDialog) {
TestAccessInitialDocumentWebFrameClient web_frame_client; TestAccessInitialDocumentWebFrameClient web_frame_client;
FrameTestHelpers::WebViewHelper web_view_helper; FrameTestHelpers::WebViewHelper web_view_helper;
web_view_helper.Initialize(&web_frame_client); web_view_helper.Initialize(&web_frame_client);
...@@ -7055,8 +7058,7 @@ TEST_P(ParameterizedWebFrameTest, DidAccessInitialDocumentBodyBeforeModalDialog) ...@@ -7055,8 +7058,7 @@ TEST_P(ParameterizedWebFrameTest, DidAccessInitialDocumentBodyBeforeModalDialog)
web_view_helper.Reset(); web_view_helper.Reset();
} }
TEST_P(ParameterizedWebFrameTest, DidWriteToInitialDocumentBeforeModalDialog) TEST_P(ParameterizedWebFrameTest, DidWriteToInitialDocumentBeforeModalDialog) {
{
TestAccessInitialDocumentWebFrameClient web_frame_client; TestAccessInitialDocumentWebFrameClient web_frame_client;
FrameTestHelpers::WebViewHelper web_view_helper; FrameTestHelpers::WebViewHelper web_view_helper;
web_view_helper.Initialize(&web_frame_client); web_view_helper.Initialize(&web_frame_client);
...@@ -7793,13 +7795,11 @@ TEST_P(ParameterizedWebFrameTest, FirstNonBlankSubframeNavigation) { ...@@ -7793,13 +7795,11 @@ TEST_P(ParameterizedWebFrameTest, FirstNonBlankSubframeNavigation) {
WebLocalFrame* frame = web_view_helper.LocalMainFrame(); WebLocalFrame* frame = web_view_helper.LocalMainFrame();
std::string url1 = base_url_ + "history.html"; std::string url1 = base_url_ + "history.html";
FrameTestHelpers::LoadFrame( std::string load_frame_js =
frame,
"javascript:var f = document.createElement('iframe'); " "javascript:var f = document.createElement('iframe'); "
"f.src = '" + "f.src = '";
url1 + load_frame_js += url1 + "';" + "document.body.appendChild(f)";
"';" FrameTestHelpers::LoadFrame(frame, load_frame_js);
"document.body.appendChild(f)");
WebLocalFrame* iframe = frame->FirstChild()->ToWebLocalFrame(); WebLocalFrame* iframe = frame->FirstChild()->ToWebLocalFrame();
EXPECT_EQ(url1, iframe->GetDocument().Url().GetString().Utf8()); EXPECT_EQ(url1, iframe->GetDocument().Url().GetString().Utf8());
......
...@@ -69,11 +69,8 @@ test("webkit_unit_tests") { ...@@ -69,11 +69,8 @@ test("webkit_unit_tests") {
# FIXME: Move the tests from web/tests/ to appropriate places. # FIXME: Move the tests from web/tests/ to appropriate places.
# crbug.com/353585 # crbug.com/353585
"tests/LayoutGeometryMapTest.cpp",
"tests/RunAllTests.cpp", "tests/RunAllTests.cpp",
"tests/VirtualTimeTest.cpp", "tests/VirtualTimeTest.cpp",
"tests/WebFrameSerializerSanitizationTest.cpp",
"tests/WebFrameTest.cpp",
] ]
sources += bindings_unittest_files sources += bindings_unittest_files
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment