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

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

Issue 455523002: [Checkstyle] Update static variable and constant names to match style guides. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: yfriendman's nits Created 6 years, 4 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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.SmallTest; 7 import android.test.suitebuilder.annotation.SmallTest;
8 import android.util.Pair; 8 import android.util.Pair;
9 9
10 import org.chromium.android_webview.AwContents; 10 import org.chromium.android_webview.AwContents;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 public ShouldInterceptRequestHelper getShouldInterceptRequestHelper() { 111 public ShouldInterceptRequestHelper getShouldInterceptRequestHelper() {
112 return mShouldInterceptRequestHelper; 112 return mShouldInterceptRequestHelper;
113 } 113 }
114 114
115 public OnLoadResourceHelper getOnLoadResourceHelper() { 115 public OnLoadResourceHelper getOnLoadResourceHelper() {
116 return mOnLoadResourceHelper; 116 return mOnLoadResourceHelper;
117 } 117 }
118 } 118 }
119 119
120 private static final int TEAPOT_STATUS_CODE = 418; 120 private static final int TEAPOT_STATUS_CODE = 418;
121 private static final String TEAPOD_RESPONSE_PHRASE = "I'm a teapot"; 121 private static final String TEAPOT_RESPONSE_PHRASE = "I'm a teapot";
122 122
123 private String addPageToTestServer(TestWebServer webServer, String httpPath, String html) { 123 private String addPageToTestServer(TestWebServer webServer, String httpPath, String html) {
124 List<Pair<String, String>> headers = new ArrayList<Pair<String, String>> (); 124 List<Pair<String, String>> headers = new ArrayList<Pair<String, String>> ();
125 headers.add(Pair.create("Content-Type", "text/html")); 125 headers.add(Pair.create("Content-Type", "text/html"));
126 headers.add(Pair.create("Cache-Control", "no-store")); 126 headers.add(Pair.create("Cache-Control", "no-store"));
127 return webServer.setResponse(httpPath, html, headers); 127 return webServer.setResponse(httpPath, html, headers);
128 } 128 }
129 129
130 private String addAboutPageToTestServer(TestWebServer webServer) { 130 private String addAboutPageToTestServer(TestWebServer webServer) {
131 return addPageToTestServer(webServer, "/" + CommonResources.ABOUT_FILENA ME, 131 return addPageToTestServer(webServer, "/" + CommonResources.ABOUT_FILENA ME,
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 assertEquals("\"[404][Not Found]\"", 485 assertEquals("\"[404][Not Found]\"",
486 executeJavaScriptAndWaitForResult(mAwContents, mContentsClient, syncGetJs)); 486 executeJavaScriptAndWaitForResult(mAwContents, mContentsClient, syncGetJs));
487 487
488 mShouldInterceptRequestHelper.setReturnValue( 488 mShouldInterceptRequestHelper.setReturnValue(
489 new AwWebResourceResponse("text/html", "UTF-8", new EmptyInputSt ream())); 489 new AwWebResourceResponse("text/html", "UTF-8", new EmptyInputSt ream()));
490 assertEquals("\"[200][OK]\"", 490 assertEquals("\"[200][OK]\"",
491 executeJavaScriptAndWaitForResult(mAwContents, mContentsClient, syncGetJs)); 491 executeJavaScriptAndWaitForResult(mAwContents, mContentsClient, syncGetJs));
492 492
493 mShouldInterceptRequestHelper.setReturnValue( 493 mShouldInterceptRequestHelper.setReturnValue(
494 new AwWebResourceResponse("text/html", "UTF-8", new EmptyInputSt ream(), 494 new AwWebResourceResponse("text/html", "UTF-8", new EmptyInputSt ream(),
495 TEAPOT_STATUS_CODE, TEAPOD_RESPONSE_PHRASE, new HashMap<Stri ng, String>())); 495 TEAPOT_STATUS_CODE, TEAPOT_RESPONSE_PHRASE, new HashMap<Stri ng, String>()));
496 assertEquals("\"[" + TEAPOT_STATUS_CODE + "][" + TEAPOD_RESPONSE_PHRASE + "]\"", 496 assertEquals("\"[" + TEAPOT_STATUS_CODE + "][" + TEAPOT_RESPONSE_PHRASE + "]\"",
497 executeJavaScriptAndWaitForResult(mAwContents, mContentsClient, syncGetJs)); 497 executeJavaScriptAndWaitForResult(mAwContents, mContentsClient, syncGetJs));
498 } 498 }
499 499
500 private String getHeaderValue(AwContents awContents, TestAwContentsClient co ntentsClient, 500 private String getHeaderValue(AwContents awContents, TestAwContentsClient co ntentsClient,
501 String url, String headerName) throws Exception { 501 String url, String headerName) throws Exception {
502 final String syncGetJs = 502 final String syncGetJs =
503 "(function() {" + 503 "(function() {" +
504 " var xhr = new XMLHttpRequest();" + 504 " var xhr = new XMLHttpRequest();" +
505 " xhr.open('GET', '" + url + "', false);" + 505 " xhr.open('GET', '" + url + "', false);" +
506 " xhr.send(null);" + 506 " xhr.send(null);" +
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 getInstrumentation().getTargetContext(), contentResourceName); 780 getInstrumentation().getTargetContext(), contentResourceName);
781 assertEquals(1, contentRequestCount); 781 assertEquals(1, contentRequestCount);
782 } 782 }
783 783
784 @SmallTest 784 @SmallTest
785 @Feature({"AndroidWebView"}) 785 @Feature({"AndroidWebView"})
786 public void testCalledForNonexistentContentUrl() throws Throwable { 786 public void testCalledForNonexistentContentUrl() throws Throwable {
787 calledForUrlTemplate("content://org.chromium.webview.NoSuchProvider/foo" ); 787 calledForUrlTemplate("content://org.chromium.webview.NoSuchProvider/foo" );
788 } 788 }
789 } 789 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698