| OLD | NEW |
| 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.os.Build; | 7 import android.os.Build; |
| 8 import android.test.suitebuilder.annotation.SmallTest; | 8 import android.test.suitebuilder.annotation.SmallTest; |
| 9 import android.webkit.ValueCallback; | 9 import android.webkit.ValueCallback; |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 private AwTestContainerView mTestContainerView; | 37 private AwTestContainerView mTestContainerView; |
| 38 | 38 |
| 39 @Override | 39 @Override |
| 40 protected void setUp() throws Exception { | 40 protected void setUp() throws Exception { |
| 41 super.setUp(); | 41 super.setUp(); |
| 42 mTestContainerView = createAwTestContainerViewOnMainSync(mContentsClient
); | 42 mTestContainerView = createAwTestContainerViewOnMainSync(mContentsClient
); |
| 43 } | 43 } |
| 44 | 44 |
| 45 private void deleteFile(String path) { | 45 private void deleteFile(String path) { |
| 46 File file = new File(path); | 46 File file = new File(path); |
| 47 if (file.exists()) | 47 if (file.exists()) assertTrue(file.delete()); |
| 48 assertTrue(file.delete()); | |
| 49 assertFalse(file.exists()); | 48 assertFalse(file.exists()); |
| 50 } | 49 } |
| 51 | 50 |
| 52 private void doArchiveTest(final AwContents contents, final String path, | 51 private void doArchiveTest(final AwContents contents, final String path, |
| 53 final boolean autoName, String expectedPath) throws InterruptedExcep
tion { | 52 final boolean autoName, String expectedPath) throws InterruptedExcep
tion { |
| 54 if (expectedPath != null) { | 53 if (expectedPath != null) { |
| 55 deleteFile(expectedPath); | 54 deleteFile(expectedPath); |
| 56 } | 55 } |
| 57 | 56 |
| 58 // Set up a handler to handle the completion callback | 57 // Set up a handler to handle the completion callback |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 final String path = new File("/foo/bar/").getAbsolutePath(); | 141 final String path = new File("/foo/bar/").getAbsolutePath(); |
| 143 deleteFile(path); | 142 deleteFile(path); |
| 144 | 143 |
| 145 loadUrlSync(mTestContainerView.getAwContents(), | 144 loadUrlSync(mTestContainerView.getAwContents(), |
| 146 mContentsClient.getOnPageFinishedHelper(), TEST_PAGE); | 145 mContentsClient.getOnPageFinishedHelper(), TEST_PAGE); |
| 147 | 146 |
| 148 doArchiveTest(mTestContainerView.getAwContents(), path, true, null); | 147 doArchiveTest(mTestContainerView.getAwContents(), path, true, null); |
| 149 } | 148 } |
| 150 | 149 |
| 151 } | 150 } |
| OLD | NEW |