Merge "Fixed strict mode violation in history"
diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java
index 13a0101..1410ce8 100644
--- a/src/com/android/browser/BrowserBookmarksPage.java
+++ b/src/com/android/browser/BrowserBookmarksPage.java
@@ -405,7 +405,8 @@
hc = (ViewGroup) root.findViewById(R.id.header_container);
hc.setVisibility(View.VISIBLE);
}
- mHeader = inflater.inflate(R.layout.bookmarks_header, hc, true);
+ mHeader = inflater.inflate(R.layout.bookmarks_header, hc, false);
+ hc.addView(mHeader);
mCrumbs = (BreadCrumbView) mHeader.findViewById(R.id.crumbs);
mCrumbs.setController(this);
mCrumbs.setUseBackButton(mCrumbBackButton);
diff --git a/tests/src/com/android/browser/PopularUrlsTest.java b/tests/src/com/android/browser/PopularUrlsTest.java
index ad1fe4f..ac9a90e 100644
--- a/tests/src/com/android/browser/PopularUrlsTest.java
+++ b/tests/src/com/android/browser/PopularUrlsTest.java
@@ -19,9 +19,9 @@
import android.app.Instrumentation;
import android.content.Context;
import android.content.Intent;
-import android.content.res.AssetManager;
import android.net.Uri;
import android.net.http.SslError;
+import android.os.Environment;
import android.test.ActivityInstrumentationTestCase2;
import android.text.TextUtils;
import android.util.Log;
@@ -37,7 +37,6 @@
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
-import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Iterator;
import java.util.LinkedList;
@@ -56,6 +55,7 @@
private final static String sInputFile = "popular_urls.txt";
private final static String sOutputFile = "test_output.txt";
private final static String sStatusFile = "test_status.txt";
+ private final static File sExternalStorage = Environment.getExternalStorageDirectory();
private final static int PERF_LOOPCOUNT = 10;
private final static int STABILITY_LOOPCOUNT = 1;
@@ -83,7 +83,7 @@
mInst = getInstrumentation();
mInst.waitForIdleSync();
- mStatus = RunStatus.load(getInstrumentation().getContext());
+ mStatus = RunStatus.load();
}
@Override
@@ -95,10 +95,15 @@
super.tearDown();
}
- BufferedReader getInputStream() throws IOException {
- AssetManager assets = getInstrumentation().getContext().getAssets();
- return new BufferedReader(
- new InputStreamReader(assets.open(sInputFile)));
+ BufferedReader getInputStream() throws FileNotFoundException {
+ return getInputStream(sInputFile);
+ }
+
+ BufferedReader getInputStream(String inputFile) throws FileNotFoundException {
+ FileReader fileReader = new FileReader(new File(sExternalStorage, inputFile));
+ BufferedReader bufferedReader = new BufferedReader(fileReader);
+
+ return bufferedReader;
}
OutputStreamWriter getOutputStream() throws IOException {
@@ -106,9 +111,7 @@
}
OutputStreamWriter getOutputStream(String outputFile) throws IOException {
- File file = new File(getInstrumentation().getContext()
- .getExternalFilesDir(null), outputFile);
- return new FileWriter(file, mStatus.getIsRecovery());
+ return new FileWriter(new File(sExternalStorage, outputFile), mStatus.getIsRecovery());
}
/**
@@ -313,13 +316,12 @@
}
}
- public static RunStatus load(Context context) throws IOException {
- return load(context, sStatusFile);
+ public static RunStatus load() throws IOException {
+ return load(sStatusFile);
}
- public static RunStatus load(Context context, String file) throws IOException {
- return new RunStatus(new File(
- context.getExternalFilesDir(null), file));
+ public static RunStatus load(String file) throws IOException {
+ return new RunStatus(new File(sExternalStorage, file));
}
public void write() throws IOException {