Commit b5afe61e authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Extensions] Hopefully de-flake MessagingUtilTest.TestMaximumMessageSize

MessagingUtilTest.TestMaximumMessageSize exercises our extension message
limits by trying to send large messages. Unfortunately, large messages
take a long time to construct, which, it appears, can result in the test
timing out.

The test currently runs two virtually-identical cases (a massive string
and a massive JSON-ified string). Remove the JSON-ified case to cut the
effective test duration in half.

Bug: 1093817
Change-Id: I597b8ad1c66fb894c8b1520230c779aa70107c6f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2259473Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781379}
parent ae44770e
...@@ -28,26 +28,13 @@ TEST_F(MessagingUtilTest, TestMaximumMessageSize) { ...@@ -28,26 +28,13 @@ TEST_F(MessagingUtilTest, TestMaximumMessageSize) {
constexpr char kMessageTooLongError[] = constexpr char kMessageTooLongError[] =
"Message length exceeded maximum allowed length."; "Message length exceeded maximum allowed length.";
{ v8::Local<v8::Value> long_message =
v8::Local<v8::Value> long_message = V8ValueFromScriptSource(context, "'a'.repeat(1024 *1024 * 65)");
V8ValueFromScriptSource(context, "'a'.repeat(1024 *1024 * 65)"); std::string error;
std::string error; std::unique_ptr<Message> message =
std::unique_ptr<Message> message = messaging_util::MessageFromV8(context, long_message, &error);
messaging_util::MessageFromV8(context, long_message, &error); EXPECT_FALSE(message);
EXPECT_FALSE(message); EXPECT_EQ(kMessageTooLongError, error);
EXPECT_EQ(kMessageTooLongError, error);
}
{
v8::Local<v8::Value> long_json_message = V8ValueFromScriptSource(
context, "(JSON.stringify('a'.repeat(1024 *1024 * 65)))");
ASSERT_TRUE(long_json_message->IsString());
std::string error;
std::unique_ptr<Message> message = messaging_util::MessageFromV8(
context, long_json_message.As<v8::String>(), &error);
EXPECT_FALSE(message);
EXPECT_EQ(kMessageTooLongError, error);
}
} }
TEST_F(MessagingUtilTest, TestParseMessageOptionsFrameId) { TEST_F(MessagingUtilTest, TestParseMessageOptionsFrameId) {
......
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