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

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

Issue 11028094: [android_webview] Use AwContents loadUrl method instead of ContentViewCore. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase yet again Created 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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.webkit.ValueCallback; 8 import android.webkit.ValueCallback;
9 9
10 import org.chromium.android_webview.AwContents; 10 import org.chromium.android_webview.AwContents;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 73 }
74 74
75 @SmallTest 75 @SmallTest
76 @Feature({"Android-WebView"}) 76 @Feature({"Android-WebView"})
77 public void testExplicitGoodPath() throws Throwable { 77 public void testExplicitGoodPath() throws Throwable {
78 final String path = new File(getActivity().getFilesDir(), "test.mht").ge tAbsolutePath(); 78 final String path = new File(getActivity().getFilesDir(), "test.mht").ge tAbsolutePath();
79 File file = new File(path); 79 File file = new File(path);
80 file.delete(); 80 file.delete();
81 assertFalse(file.exists()); 81 assertFalse(file.exists());
82 82
83 loadUrlSync(mTestContainerView.getContentViewCore(), 83 loadUrlSync(mTestContainerView.getAwContents(),
84 mContentsClient.getOnPageFinishedHelper(), TEST_PAGE); 84 mContentsClient.getOnPageFinishedHelper(), TEST_PAGE);
85 85
86 doArchiveTest(mTestContainerView.getAwContents(), path, false, path); 86 doArchiveTest(mTestContainerView.getAwContents(), path, false, path);
87 } 87 }
88 88
89 @SmallTest 89 @SmallTest
90 @Feature({"Android-WebView"}) 90 @Feature({"Android-WebView"})
91 public void testAutoGoodPath() throws Throwable { 91 public void testAutoGoodPath() throws Throwable {
92 final String path = getActivity().getFilesDir().getAbsolutePath() + "/"; 92 final String path = getActivity().getFilesDir().getAbsolutePath() + "/";
93 93
94 loadUrlSync(mTestContainerView.getContentViewCore(), 94 loadUrlSync(mTestContainerView.getAwContents(),
95 mContentsClient.getOnPageFinishedHelper(), TEST_PAGE); 95 mContentsClient.getOnPageFinishedHelper(), TEST_PAGE);
96 96
97 // Create the first archive 97 // Create the first archive
98 { 98 {
99 String expectedPath = path + "index.mht"; 99 String expectedPath = path + "index.mht";
100 doArchiveTest(mTestContainerView.getAwContents(), path, true, expect edPath); 100 doArchiveTest(mTestContainerView.getAwContents(), path, true, expect edPath);
101 } 101 }
102 102
103 // Create a second archive, making sure that the second archive's name i s auto incremented. 103 // Create a second archive, making sure that the second archive's name i s auto incremented.
104 { 104 {
105 String expectedPath = path + "index-1.mht"; 105 String expectedPath = path + "index-1.mht";
106 doArchiveTest(mTestContainerView.getAwContents(), path, true, expect edPath); 106 doArchiveTest(mTestContainerView.getAwContents(), path, true, expect edPath);
107 } 107 }
108 } 108 }
109 109
110 @SmallTest 110 @SmallTest
111 @Feature({"Android-WebView"}) 111 @Feature({"Android-WebView"})
112 public void testExplicitBadPath() throws Throwable { 112 public void testExplicitBadPath() throws Throwable {
113 final String path = new File("/foo/bar/baz.mht").getAbsolutePath(); 113 final String path = new File("/foo/bar/baz.mht").getAbsolutePath();
114 File file = new File(path); 114 File file = new File(path);
115 file.delete(); 115 file.delete();
116 assertFalse(file.exists()); 116 assertFalse(file.exists());
117 117
118 loadUrlSync(mTestContainerView.getContentViewCore(), 118 loadUrlSync(mTestContainerView.getAwContents(),
119 mContentsClient.getOnPageFinishedHelper(), TEST_PAGE); 119 mContentsClient.getOnPageFinishedHelper(), TEST_PAGE);
120 120
121 doArchiveTest(mTestContainerView.getAwContents(), path, false, null); 121 doArchiveTest(mTestContainerView.getAwContents(), path, false, null);
122 } 122 }
123 123
124 @SmallTest 124 @SmallTest
125 @Feature({"Android-WebView"}) 125 @Feature({"Android-WebView"})
126 public void testAutoBadPath() throws Throwable { 126 public void testAutoBadPath() throws Throwable {
127 final String path = new File("/foo/bar/").getAbsolutePath(); 127 final String path = new File("/foo/bar/").getAbsolutePath();
128 File file = new File(path); 128 File file = new File(path);
129 file.delete(); 129 file.delete();
130 assertFalse(file.exists()); 130 assertFalse(file.exists());
131 131
132 loadUrlSync(mTestContainerView.getContentViewCore(), 132 loadUrlSync(mTestContainerView.getAwContents(),
133 mContentsClient.getOnPageFinishedHelper(), TEST_PAGE); 133 mContentsClient.getOnPageFinishedHelper(), TEST_PAGE);
134 134
135 doArchiveTest(mTestContainerView.getAwContents(), path, true, null); 135 doArchiveTest(mTestContainerView.getAwContents(), path, true, null);
136 } 136 }
137 137
138 } 138 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698