Commit 8fbbd473 authored by Shakti Sahu's avatar Shakti Sahu Committed by Commit Bot

Video tutorials : Handle unknown features

This CL adds
1 - Support unknown features sent from server at the client
2 - UI improvement for video length

Change-Id: I1666e23aae6a3772e2b8478d7a7d37a99e8f104d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2494422Reviewed-by: default avatarMin Qin <qinmin@chromium.org>
Commit-Queue: Shakti Sahu <shaktisahu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#820414}
parent 6866d354
...@@ -53,10 +53,13 @@ ...@@ -53,10 +53,13 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="11dp" android:layout_marginStart="11dp"
android:layout_marginBottom="11dp" android:layout_marginBottom="11dp"
android:background="@color/modern_grey_900"
android:paddingStart="4dp"
android:paddingEnd="4dp"
app:layout_column="0" app:layout_column="0"
app:layout_row="0" app:layout_row="0"
app:layout_gravity="bottom" app:layout_gravity="bottom"
android:textAppearance="@style/TextAppearance.TextMedium.Secondary" /> android:textAppearance="@style/TextAppearance.TextSmall.Primary.Light" />
<TextView <TextView
android:id="@+id/title" android:id="@+id/title"
......
...@@ -26,9 +26,8 @@ FeatureType ToFeatureType(proto::FeatureType type) { ...@@ -26,9 +26,8 @@ FeatureType ToFeatureType(proto::FeatureType type) {
case proto::FeatureType::TEST: case proto::FeatureType::TEST:
return FeatureType::kTest; return FeatureType::kTest;
default: default:
NOTREACHED(); return static_cast<FeatureType>(type);
} }
return FeatureType::kInvalid;
} }
proto::FeatureType FromFeatureType(FeatureType type) { proto::FeatureType FromFeatureType(FeatureType type) {
...@@ -48,9 +47,8 @@ proto::FeatureType FromFeatureType(FeatureType type) { ...@@ -48,9 +47,8 @@ proto::FeatureType FromFeatureType(FeatureType type) {
case FeatureType::kTest: case FeatureType::kTest:
return proto::FeatureType::TEST; return proto::FeatureType::TEST;
default: default:
NOTREACHED(); return static_cast<proto::FeatureType>(type);
} }
return proto::FeatureType::INVALID;
} }
} // namespace } // namespace
......
...@@ -23,6 +23,13 @@ TEST(VideoTutorialsProtoConversionsTest, FeatureConversion) { ...@@ -23,6 +23,13 @@ TEST(VideoTutorialsProtoConversionsTest, FeatureConversion) {
TutorialFromProto(&intermediate, &actual); TutorialFromProto(&intermediate, &actual);
EXPECT_EQ(expected, actual); EXPECT_EQ(expected, actual);
} }
// Test an unknown feature.
FeatureType unknown = static_cast<FeatureType>(80);
expected.feature = unknown;
TutorialToProto(&expected, &intermediate);
TutorialFromProto(&intermediate, &actual);
EXPECT_EQ(expected, actual);
} }
// Verify round-way conversion of Tutorial struct. // Verify round-way conversion of Tutorial struct.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment