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

Unified Diff: chrome/android/sync_shell/javatests/src/chromium/chrome/browser/sync/FakeServerHelper.java

Issue 1083683003: Speculative revert by sheriff (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed an unrelated commit that had accidentally slipped in. Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/sync_shell/javatests/src/chromium/chrome/browser/sync/FakeServerHelper.java
diff --git a/chrome/android/sync_shell/javatests/src/chromium/chrome/browser/sync/FakeServerHelper.java b/chrome/android/sync_shell/javatests/src/chromium/chrome/browser/sync/FakeServerHelper.java
index b25eca167fb2561ca76f4473cd822242b34d47dc..d2a6d150af6f62de862a5da8d580af30979dc1ff 100644
--- a/chrome/android/sync_shell/javatests/src/chromium/chrome/browser/sync/FakeServerHelper.java
+++ b/chrome/android/sync_shell/javatests/src/chromium/chrome/browser/sync/FakeServerHelper.java
@@ -71,8 +71,11 @@ public class FakeServerHelper {
* Deletes the existing FakeServer.
*/
public static void deleteFakeServer() {
- checkFakeServerInitialized(
- "useFakeServer must be called before calling deleteFakeServer.");
+ if (sNativeFakeServer == 0L) {
+ throw new IllegalStateException(
+ "useFakeServer must be called before calling deleteFakeServer.");
+ }
+
ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Void>() {
@Override
public Void call() {
@@ -124,8 +127,10 @@ public class FakeServerHelper {
* @return whether the number of specified entities exist
*/
public boolean verifyEntityCountByTypeAndName(int count, ModelType modelType, String name) {
- checkFakeServerInitialized(
+ if (sNativeFakeServer == 0L) {
+ throw new IllegalStateException(
"useFakeServer must be called before data verification.");
+ }
return nativeVerifyEntityCountByTypeAndName(mNativeFakeServerHelperAndroid,
sNativeFakeServer, count, modelType.toString(), name);
}
@@ -139,44 +144,16 @@ public class FakeServerHelper {
* @param entitySpecifics the EntitySpecifics proto that represents the entity to inject
*/
public void injectUniqueClientEntity(String name, EntitySpecifics entitySpecifics) {
- checkFakeServerInitialized("useFakeServer must be called before data injection.");
+ if (sNativeFakeServer == 0L) {
+ throw new IllegalStateException(
+ "useFakeServer must be called before data injection.");
+ }
// The protocol buffer is serialized as a byte array because it can be easily deserialized
// from this format in native code.
nativeInjectUniqueClientEntity(mNativeFakeServerHelperAndroid, sNativeFakeServer, name,
MessageNano.toByteArray(entitySpecifics));
}
- /**
- * Injects a bookmark into the fake Sync server.
- *
- * @param title the title of the bookmark to inject
- * @param url the URL of the bookmark to inject. This String will be passed to the native GURL
- * class, so it must be a valid URL under its definition.
- * @param parentId the ID of the desired parent bookmark folder
- */
- public void injectBookmarkEntity(String title, String url, String parentId) {
- checkFakeServerInitialized("useFakeServer must be called before data injection.");
- nativeInjectBookmarkEntity(mNativeFakeServerHelperAndroid, sNativeFakeServer, title, url,
- parentId);
- }
-
- /**
- * Returns the ID of the Bookmark Bar. This value is to be used in conjunction with
- * injectBookmarkEntity.
- *
- * @return the opaque ID of the bookmark bar entity stored in the server
- */
- public String getBookmarkBarFolderId() {
- checkFakeServerInitialized("useFakeServer must be called before access");
- return nativeGetBookmarkBarFolderId(mNativeFakeServerHelperAndroid, sNativeFakeServer);
- }
-
- private static void checkFakeServerInitialized(String failureMessage) {
- if (sNativeFakeServer == 0L) {
- throw new IllegalStateException(failureMessage);
- }
- }
-
// Native methods.
private native long nativeInit();
private native long nativeCreateFakeServer(long nativeFakeServerHelperAndroid);
@@ -190,9 +167,4 @@ public class FakeServerHelper {
private native void nativeInjectUniqueClientEntity(
long nativeFakeServerHelperAndroid, long nativeFakeServer, String name,
byte[] serializedEntitySpecifics);
- private native void nativeInjectBookmarkEntity(
- long nativeFakeServerHelperAndroid, long nativeFakeServer, String title, String url,
- String parentId);
- private native String nativeGetBookmarkBarFolderId(
- long nativeFakeServerHelperAndroid, long nativeFakeServer);
}

Powered by Google App Engine
This is Rietveld 408576698