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

Side by Side Diff: third_party/WebKit/Source/web/tests/ResizeObserverTest.cpp

Issue 2305893002: Fix svg contentrect location (Closed)
Patch Set: forgot to fix c++ tests Created 4 years, 3 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 | « third_party/WebKit/Source/core/observer/ResizeObserverEntry.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "core/observer/ResizeObserver.h" 5 #include "core/observer/ResizeObserver.h"
6 6
7 #include "bindings/core/v8/ScriptController.h" 7 #include "bindings/core/v8/ScriptController.h"
8 #include "bindings/core/v8/ScriptSourceCode.h" 8 #include "bindings/core/v8/ScriptSourceCode.h"
9 #include "bindings/core/v8/V8GCController.h" 9 #include "bindings/core/v8/V8GCController.h"
10 #include "core/observer/ResizeObservation.h" 10 #include "core/observer/ResizeObservation.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 Element* domTarget = document().getElementById("domTarget"); 76 Element* domTarget = document().getElementById("domTarget");
77 Element* svgTarget = document().getElementById("svgTarget"); 77 Element* svgTarget = document().getElementById("svgTarget");
78 ResizeObservation* domObservation = new ResizeObservation(domTarget, observe r); 78 ResizeObservation* domObservation = new ResizeObservation(domTarget, observe r);
79 ResizeObservation* svgObservation = new ResizeObservation(svgTarget, observe r); 79 ResizeObservation* svgObservation = new ResizeObservation(svgTarget, observe r);
80 80
81 // Initial observation is out of sync 81 // Initial observation is out of sync
82 ASSERT_TRUE(domObservation->observationSizeOutOfSync()); 82 ASSERT_TRUE(domObservation->observationSizeOutOfSync());
83 ASSERT_TRUE(svgObservation->observationSizeOutOfSync()); 83 ASSERT_TRUE(svgObservation->observationSizeOutOfSync());
84 84
85 // Target size is correct 85 // Target size is correct
86 LayoutSize size = ResizeObservation::getTargetSize(domTarget); 86 LayoutSize size = domObservation->computeTargetSize();
87 ASSERT_EQ(size.width(), 100); 87 ASSERT_EQ(size.width(), 100);
88 ASSERT_EQ(size.height(), 100); 88 ASSERT_EQ(size.height(), 100);
89 domObservation->setObservationSize(size); 89 domObservation->setObservationSize(size);
90 90
91 size = ResizeObservation::getTargetSize(svgTarget); 91 size = svgObservation->computeTargetSize();
92 ASSERT_EQ(size.width(), 200); 92 ASSERT_EQ(size.width(), 200);
93 ASSERT_EQ(size.height(), 200); 93 ASSERT_EQ(size.height(), 200);
94 svgObservation->setObservationSize(size); 94 svgObservation->setObservationSize(size);
95 95
96 // Target size is in sync 96 // Target size is in sync
97 ASSERT_FALSE(domObservation->observationSizeOutOfSync()); 97 ASSERT_FALSE(domObservation->observationSizeOutOfSync());
98 98
99 // Target depths 99 // Target depths
100 ASSERT_EQ(svgObservation->targetDepth() - domObservation->targetDepth(), (si ze_t)1); 100 ASSERT_EQ(svgObservation->targetDepth() - domObservation->targetDepth(), (si ze_t)1);
101 } 101 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 ASSERT_EQ(observers.size(), 1U); 141 ASSERT_EQ(observers.size(), 1U);
142 script.executeScriptInMainWorldAndReturnValue( 142 script.executeScriptInMainWorldAndReturnValue(
143 ScriptSourceCode("el = undefined;"), 143 ScriptSourceCode("el = undefined;"),
144 ScriptController::ExecuteScriptWhenScriptsDisabled); 144 ScriptController::ExecuteScriptWhenScriptsDisabled);
145 V8GCController::collectAllGarbageForTesting(v8::Isolate::GetCurrent()); 145 V8GCController::collectAllGarbageForTesting(v8::Isolate::GetCurrent());
146 WebHeap::collectAllGarbageForTesting(); 146 WebHeap::collectAllGarbageForTesting();
147 ASSERT_EQ(observers.isEmpty(), true); 147 ASSERT_EQ(observers.isEmpty(), true);
148 } 148 }
149 149
150 } // namespace blink 150 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/observer/ResizeObserverEntry.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698