Commit fa52e703 authored by tsepez@chromium.org's avatar tsepez@chromium.org

Fix js_to_cpp_unittest handling of null arrays.

This test is still disabled pending resolution of some mojo message
validation issues, but this version sould be correct given a correct
message validator.

In other words, running this with --gtest_also_run_disabled_tests is
a good way to test a message validator.

BUG=366797

Review URL: https://codereview.chromium.org/284243002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270834 0039d316-1c4b-4281-b951-d872f2087c98
parent b4b49a50
......@@ -127,12 +127,15 @@ void CheckDataPipe(MojoHandle data_pipe_handle) {
void CheckCorruptedString(const mojo::String& arg) {
// The values don't matter so long as all accesses are within bounds.
std::string name = arg.To<std::string>();
for (size_t i = 0; i < name.length(); ++i)
g_waste_accumulator += name[i];
if (arg.is_null())
return;
for (size_t i = 0; i < arg.size(); ++i)
g_waste_accumulator += arg[i];
}
void CheckCorruptedStringArray(const mojo::Array<mojo::String>& string_array) {
if (string_array.is_null())
return;
for (size_t i = 0; i < string_array.size(); ++i)
CheckCorruptedString(string_array[i]);
}
......
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