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

Unified Diff: third_party/protobuf/java/core/src/test/java/com/google/protobuf/TestUtil.java

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years 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: third_party/protobuf/java/core/src/test/java/com/google/protobuf/TestUtil.java
diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/TestUtil.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/TestUtil.java
index 08b2a76d925e07b7eb52599036a4b344a941f453..d4a18a22ba612e88ab18ebabf6c79bdc23fc070f 100644
--- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/TestUtil.java
+++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/TestUtil.java
@@ -232,12 +232,10 @@ import protobuf_unittest.UnittestProto.TestOneof2;
import protobuf_unittest.UnittestProto.TestPackedExtensions;
import protobuf_unittest.UnittestProto.TestPackedTypes;
import protobuf_unittest.UnittestProto.TestUnpackedTypes;
-
-import junit.framework.Assert;
-
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
+import junit.framework.Assert;
/**
* Contains methods for setting all fields of {@code TestAllTypes} to
@@ -260,6 +258,13 @@ public final class TestUtil {
}
/**
+ * Dirties the message by resetting the momoized serialized size.
+ */
+ public static void resetMemoizedSize(AbstractMessage message) {
+ message.memoizedSize = -1;
+ }
+
+ /**
* Get a {@code TestAllTypes} with all fields set as they would be by
* {@link #setAllFields(TestAllTypes.Builder)}.
*/
@@ -3764,7 +3769,8 @@ public final class TestUtil {
private static File getTestDataDir() {
// Search each parent directory looking for "src/google/protobuf".
- File ancestor = new File(".");
+ File ancestor = new File(System.getProperty("protobuf.dir", "."));
+ String initialPath = ancestor.getAbsolutePath();
try {
ancestor = ancestor.getCanonicalFile();
} catch (IOException e) {
@@ -3781,7 +3787,7 @@ public final class TestUtil {
throw new RuntimeException(
"Could not find golden files. This test must be run from within the " +
"protobuf source package so that it can read test data files from the " +
- "C++ source tree.");
+ "C++ source tree: " + initialPath);
}
/**

Powered by Google App Engine
This is Rietveld 408576698