diff --git a/shell/platform/common/client_wrapper/encodable_value_unittests.cc b/shell/platform/common/client_wrapper/encodable_value_unittests.cc index 9a02cde0813dbdb5ec2f1c8f2a222f84c2bf487a..3fcf83aa2abc7bb05f200d326a9c6b8f4e06004a 100644 --- a/shell/platform/common/client_wrapper/encodable_value_unittests.cc +++ b/shell/platform/common/client_wrapper/encodable_value_unittests.cc @@ -33,10 +33,10 @@ TEST(EncodableValueTest, Int) { // Test the int/long convenience wrapper. TEST(EncodableValueTest, LongValue) { - EncodableValue value(std::numeric_limits::max()); - EXPECT_EQ(value.LongValue(), std::numeric_limits::max()); - value = std::numeric_limits::max(); - EXPECT_EQ(value.LongValue(), std::numeric_limits::max()); + const EncodableValue int_value(std::numeric_limits::max()); + EXPECT_EQ(int_value.LongValue(), std::numeric_limits::max()); + const EncodableValue long_value(std::numeric_limits::max()); + EXPECT_EQ(long_value.LongValue(), std::numeric_limits::max()); } TEST(EncodableValueTest, Long) { diff --git a/shell/platform/common/client_wrapper/include/flutter/encodable_value.h b/shell/platform/common/client_wrapper/include/flutter/encodable_value.h index 1fbbe7e552ba7de55aed603ac07f31ac0f208327..30f4f7a5601a8d8e78a06e5d4cc477c054f40119 100644 --- a/shell/platform/common/client_wrapper/include/flutter/encodable_value.h +++ b/shell/platform/common/client_wrapper/include/flutter/encodable_value.h @@ -203,7 +203,7 @@ class EncodableValue : public internal::EncodableValueVariant { // // Calling this method if the value doesn't contain either an int32_t or an // int64_t will throw an exception. - int64_t LongValue() { + int64_t LongValue() const { if (std::holds_alternative(*this)) { return std::get(*this); }