Skip to content

Commit

Permalink
[SuperSize] Fix 2 failing caspian_unittests.
Browse files Browse the repository at this point in the history
LensTest.TestGeneratedLensJavaProto:
* Failure stated in crrev.com/c/2238379.
* Fix: Update test input file, also adding test to show old way no
  longer works.

TreeBuilderTest.TestJoinDexMethodClasses:
* Failure stated in crrev.com/c/1972231
* Fix: update test expectation.

Bug: 1040645
Change-Id: I60de00dc25a8a540dc073bd20972302bbc8c051a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2281040
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Samuel Huang <huangs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#785401}
  • Loading branch information
samuelhuang authored and Commit Bot committed Jul 6, 2020
1 parent 1cf58e5 commit 582f1f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 10 additions & 1 deletion tools/binary_size/libsupersize/caspian/lens_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,20 @@ TEST(LensTest, TestGeneratedLensNotGenerated) {
EXPECT_EQ("Not generated", GeneratedLens().ParentName(sym));
}

TEST(LensTest, TestGeneratedLensJavaProto) {
TEST(LensTest, TestGeneratedLensJavaProtoFromFilename) {
Symbol sym;
sym.section_id_ = SectionId::kDex;
sym.source_path_ = "a/b/FooProto.java";
sym.flags_ |= SymbolFlag::kGeneratedSource;
// Java filename match is insufficient for "Java Protocol Buffers" detection.
EXPECT_EQ("Generated (other)", GeneratedLens().ParentName(sym));
}

TEST(LensTest, TestGeneratedLensJavaProto) {
Symbol sym;
sym.section_id_ = SectionId::kDex;
sym.source_path_ = "a/b/foo_proto_java__protoc_java.srcjar";
sym.flags_ |= SymbolFlag::kGeneratedSource;
EXPECT_EQ("Java Protocol Buffers", GeneratedLens().ParentName(sym));
}

Expand Down
3 changes: 1 addition & 2 deletions tools/binary_size/libsupersize/caspian/tree_builder_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ TEST(TreeBuilderTest, TestJoinDexMethodClasses) {
EXPECT_EQ(1u, class_symbol["children"].size());

Json::Value method_symbol = builder.Open("a/b/c/zL2")["children"][0];
EXPECT_EQ("foo(int,android.os.Parcel,android.os.Parcel,int): boolean",
ShortName(method_symbol));
EXPECT_EQ("foo", ShortName(method_symbol));
EXPECT_EQ(0u, method_symbol["children"].size());
}
} // namespace caspian

0 comments on commit 582f1f6

Please sign in to comment.