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

Side by Side Diff: android_webview/javatests/src/org/chromium/android_webview/test/ClientOnPageStartedTest.java

Issue 2548013002: Remove redundant field initialization in Java code. (Closed)
Patch Set: rebase Created 4 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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.android_webview.test; 5 package org.chromium.android_webview.test;
6 6
7 import android.test.suitebuilder.annotation.MediumTest; 7 import android.test.suitebuilder.annotation.MediumTest;
8 8
9 import org.chromium.android_webview.AwContents; 9 import org.chromium.android_webview.AwContents;
10 import org.chromium.base.test.util.Feature; 10 import org.chromium.base.test.util.Feature;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 loadDataAsync(mAwContents, html, "text/html", false); 42 loadDataAsync(mAwContents, html, "text/html", false);
43 43
44 onPageStartedHelper.waitForCallback(currentCallCount); 44 onPageStartedHelper.waitForCallback(currentCallCount);
45 assertEquals("data:text/html," + html, onPageStartedHelper.getUrl()); 45 assertEquals("data:text/html," + html, onPageStartedHelper.getUrl());
46 } 46 }
47 47
48 @MediumTest 48 @MediumTest
49 @Feature({"AndroidWebView"}) 49 @Feature({"AndroidWebView"})
50 public void testOnPageStartedCalledOnceOnError() throws Throwable { 50 public void testOnPageStartedCalledOnceOnError() throws Throwable {
51 class LocalTestClient extends TestAwContentsClient { 51 class LocalTestClient extends TestAwContentsClient {
52 private boolean mIsOnReceivedErrorCalled = false; 52 private boolean mIsOnReceivedErrorCalled;
53 private boolean mIsOnPageStartedCalled = false; 53 private boolean mIsOnPageStartedCalled;
54 private boolean mAllowAboutBlank = false; 54 private boolean mAllowAboutBlank;
55 55
56 @Override 56 @Override
57 public void onReceivedError(int errorCode, String description, Strin g failingUrl) { 57 public void onReceivedError(int errorCode, String description, Strin g failingUrl) {
58 assertEquals("onReceivedError called twice for " + failingUrl, 58 assertEquals("onReceivedError called twice for " + failingUrl,
59 false, mIsOnReceivedErrorCalled); 59 false, mIsOnReceivedErrorCalled);
60 mIsOnReceivedErrorCalled = true; 60 mIsOnReceivedErrorCalled = true;
61 assertEquals("onPageStarted not called before onReceivedError fo r " + failingUrl, 61 assertEquals("onPageStarted not called before onReceivedError fo r " + failingUrl,
62 true, mIsOnPageStartedCalled); 62 true, mIsOnPageStartedCalled);
63 super.onReceivedError(errorCode, description, failingUrl); 63 super.onReceivedError(errorCode, description, failingUrl);
64 } 64 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 assertEquals(invalidUrl, onReceivedErrorHelper.getFailingUrl()); 98 assertEquals(invalidUrl, onReceivedErrorHelper.getFailingUrl());
99 assertEquals(invalidUrl, onPageStartedHelper.getUrl()); 99 assertEquals(invalidUrl, onPageStartedHelper.getUrl());
100 100
101 // Rather than wait a fixed time to see that another onPageStarted callb ack isn't issued 101 // Rather than wait a fixed time to see that another onPageStarted callb ack isn't issued
102 // we load a valid page. Since callbacks arrive sequentially, this will ensure that 102 // we load a valid page. Since callbacks arrive sequentially, this will ensure that
103 // any extra calls of onPageStarted / onReceivedError will arrive to our client. 103 // any extra calls of onPageStarted / onReceivedError will arrive to our client.
104 testContentsClient.setAllowAboutBlank(); 104 testContentsClient.setAllowAboutBlank();
105 loadUrlSync(mAwContents, onPageFinishedHelper, "about:blank"); 105 loadUrlSync(mAwContents, onPageFinishedHelper, "about:blank");
106 } 106 }
107 } 107 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698