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

Side by Side Diff: javatests/org/chromium/distiller/ParsedUrlTest.java

Issue 1178633002: implement parser for new pagination algorithm (Closed) Base URL: https://github.com/chromium/dom-distiller.git@master
Patch Set: addr wychen's comments Created 5 years, 2 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 | « javatests/org/chromium/distiller/PageParameterParserTest.java ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 package org.chromium.distiller; 5 package org.chromium.distiller;
6 6
7 public class ParsedUrlTest extends JsTestCase { 7 public class ParsedUrlTest extends JsTestCase {
8 8
9 private static final String VALID_URL = 9 private static final String VALID_URL =
10 "http://fooUser:fooPwd@www.foo.com/path0/path1/;pathParams?qA=B&qC=D "; 10 "http://fooUser:fooPwd@www.foo.com/path0/path1/;pathParams?qA=B&qC=D ";
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 assertEquals("newFooPwd", url.getPassword()); 47 assertEquals("newFooPwd", url.getPassword());
48 assertEquals("http://newFooUser:newFooPwd@www.foo.com/path0/path1/;pathP arams?qA=B&qC=D", 48 assertEquals("http://newFooUser:newFooPwd@www.foo.com/path0/path1/;pathP arams?qA=B&qC=D",
49 url.toString()); 49 url.toString());
50 url.setUsername(""); 50 url.setUsername("");
51 url.setPassword(""); 51 url.setPassword("");
52 assertEquals("", url.getUsername()); 52 assertEquals("", url.getUsername());
53 assertEquals("", url.getPassword()); 53 assertEquals("", url.getPassword());
54 assertEquals("http://www.foo.com/path0/path1/;pathParams?qA=B&qC=D", url .toString()); 54 assertEquals("http://www.foo.com/path0/path1/;pathParams?qA=B&qC=D", url .toString());
55 } 55 }
56 56
57 public void testSetHash() {
58 ParsedUrl url = ParsedUrl.create(VALID_URL + "#jumpToFoo");
59 assertTrue(url != null);
60 assertEquals("#jumpToFoo", url.getHash());
61 url.setHash("dontJumpToFoo");
62 assertEquals("#dontJumpToFoo", url.getHash());
63 assertEquals(VALID_URL + "#dontJumpToFoo", url.toString());
64 url.setHash("");
65 assertEquals("", url.getHash());
66 assertEquals(VALID_URL, url.toString());
67 }
68
57 public void testReplaceQueryValue() { 69 public void testReplaceQueryValue() {
58 ParsedUrl url = ParsedUrl.create(VALID_URL); 70 ParsedUrl url = ParsedUrl.create(VALID_URL);
59 assertTrue(url != null); 71 assertTrue(url != null);
60 assertEquals("?qA=B&qC=D", url.getQuery()); 72 assertEquals("?qA=B&qC=D", url.getQuery());
61 assertEquals("http://fooUser:fooPwd@www.foo.com/path0/path1/;pathParams? qA=E&qC=D", 73 assertEquals("http://fooUser:fooPwd@www.foo.com/path0/path1/;pathParams? qA=E&qC=D",
62 url.replaceQueryValue("qA", "B", "E")); 74 url.replaceQueryValue("qA", "B", "E"));
63 // Original query shouldn't change. 75 // Original query shouldn't change.
64 assertEquals("?qA=B&qC=D", url.getQuery()); 76 assertEquals("?qA=B&qC=D", url.getQuery());
65 } 77 }
66 78
67 } 79 }
OLDNEW
« no previous file with comments | « javatests/org/chromium/distiller/PageParameterParserTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698