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

Unified Diff: javatests/org/chromium/distiller/DomDistillerJsTestCase.java

Issue 1784073002: Clean attributes of mRoot between tests properly (Closed) Base URL: git@github.com:chromium/dom-distiller.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | javatests/org/chromium/distiller/OpenGraphProtocolParserTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: javatests/org/chromium/distiller/DomDistillerJsTestCase.java
diff --git a/javatests/org/chromium/distiller/DomDistillerJsTestCase.java b/javatests/org/chromium/distiller/DomDistillerJsTestCase.java
index 43dab5b7df74a542bf2eb3f0c99680706c2226f7..e5d4bc02d1deb99a7425b3ba45cd6128d9a5837e 100644
--- a/javatests/org/chromium/distiller/DomDistillerJsTestCase.java
+++ b/javatests/org/chromium/distiller/DomDistillerJsTestCase.java
@@ -27,13 +27,19 @@ public class DomDistillerJsTestCase extends JsTestCase {
protected void gwtSetUp() throws Exception {
mRoot = Document.get().getDocumentElement();
JsArray<Node> attrs = DomUtil.getAttributes(mRoot);
+ String[] attrNames = new String[attrs.length()];
for (int i = 0; i < attrs.length(); i++) {
- mRoot.removeAttribute(attrs.get(i).getNodeName());
mdjones 2016/03/11 16:58:09 I'm assuming the problem here was they we were mod
wychen 2016/03/11 21:56:32 Exactly. attrs is not deeply copied, so it didn't
+ attrNames[i] = attrs.get(i).getNodeName();
}
+ for (int i = 0; i < attrNames.length; i++) {
+ mRoot.removeAttribute(attrNames[i]);
+ }
+ assertEquals(0, DomUtil.getAttributes(mRoot).length());
NodeList<Node> children = mRoot.getChildNodes();
for (int i = children.getLength() - 1; i >= 0; i--) {
children.getItem(i).removeFromParent();
}
+ assertEquals(0, mRoot.getChildNodes().getLength());
mHead = Document.get().createElement("head");
mRoot.appendChild(mHead);
mBody = Document.get().createElement("body");
« no previous file with comments | « no previous file | javatests/org/chromium/distiller/OpenGraphProtocolParserTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698