Commit 8fec29bb authored by Ian McKellar's avatar Ian McKellar Committed by Commit Bot

Reland "[Fuchsia] Update to new FIDL string and vector APIs"

This is a reland of 5351d11f

Original change's description:
> [Fuchsia] Update to new FIDL string and vector APIs
>
> This removes usages of the old API that will become build failures when
> deprecation warnings are turned on.
>
> See: https://fuchsia-review.googlesource.com/c/fuchsia/+/304389
> Change-Id: Ie5db014401d79787101b2b4b6e7585fd7a23b1ce
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1727375
> Commit-Queue: Ian McKellar <ianloic@chromium.org>
> Reviewed-by: Wez <wez@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#682796}

TBR=ianloic

Change-Id: I805e7e0274e5f42bcbb8c53ef2afa57186d85582
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1728722Reviewed-by: default avatarWez <wez@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683008}
parent f4488a85
...@@ -288,11 +288,11 @@ class TestolaImpl : public fidljstest::Testola { ...@@ -288,11 +288,11 @@ class TestolaImpl : public fidljstest::Testola {
for (uint64_t i = 0; i < fidljstest::ARRRR_SIZE; ++i) { for (uint64_t i = 0; i < fidljstest::ARRRR_SIZE; ++i) {
sat.arrrr[i] = static_cast<int32_t>(i * 5) - 10; sat.arrrr[i] = static_cast<int32_t>(i * 5) - 10;
} }
sat.nullable_vector_of_string0 = nullptr; sat.nullable_vector_of_string0.reset();
std::vector<std::string> vector_of_str; std::vector<std::string> vector_of_str;
vector_of_str.push_back("passed_str0"); vector_of_str.push_back("passed_str0");
vector_of_str.push_back("passed_str1"); vector_of_str.push_back("passed_str1");
sat.nullable_vector_of_string1.reset(std::move(vector_of_str)); sat.nullable_vector_of_string1 = std::move(vector_of_str);
std::vector<fidljstest::Blorp> vector_of_blorp; std::vector<fidljstest::Blorp> vector_of_blorp;
vector_of_blorp.push_back(fidljstest::Blorp::GAMMA); vector_of_blorp.push_back(fidljstest::Blorp::GAMMA);
vector_of_blorp.push_back(fidljstest::Blorp::BETA); vector_of_blorp.push_back(fidljstest::Blorp::BETA);
...@@ -352,9 +352,9 @@ class TestolaImpl : public fidljstest::Testola { ...@@ -352,9 +352,9 @@ class TestolaImpl : public fidljstest::Testola {
ASSERT_EQ(nullable.size(), 5u); ASSERT_EQ(nullable.size(), 5u);
EXPECT_EQ(nullable[0], "str3"); EXPECT_EQ(nullable[0], "str3");
EXPECT_TRUE(nullable[1].is_null()); EXPECT_FALSE(nullable[1].has_value());
EXPECT_TRUE(nullable[2].is_null()); EXPECT_FALSE(nullable[2].has_value());
EXPECT_TRUE(nullable[3].is_null()); EXPECT_FALSE(nullable[3].has_value());
EXPECT_EQ(nullable[4], "str4"); EXPECT_EQ(nullable[4], "str4");
ASSERT_EQ(max_strlen.size(), 1u); ASSERT_EQ(max_strlen.size(), 1u);
......
...@@ -203,7 +203,8 @@ void CheckResponseBuffer(const oldhttp::URLResponse& response, ...@@ -203,7 +203,8 @@ void CheckResponseBuffer(const oldhttp::URLResponse& response,
void CheckResponseHeaders(const oldhttp::URLResponse& response, void CheckResponseHeaders(const oldhttp::URLResponse& response,
ResponseHeaders* expected_headers) { ResponseHeaders* expected_headers) {
for (auto& header : response.headers.get()) { ASSERT_TRUE(response.headers.has_value());
for (auto& header : response.headers.value()) {
const std::string header_name = header.name.data(); const std::string header_name = header.name.data();
const std::string header_value = header.value.data(); const std::string header_value = header.value.data();
auto iter = std::find_if(expected_headers->begin(), expected_headers->end(), auto iter = std::find_if(expected_headers->begin(), expected_headers->end(),
......
...@@ -420,12 +420,13 @@ oldhttp::URLResponse URLLoaderImpl::BuildResponse(int net_error) { ...@@ -420,12 +420,13 @@ oldhttp::URLResponse URLLoaderImpl::BuildResponse(int net_error) {
size_t iter = 0; size_t iter = 0;
std::string header_name; std::string header_name;
std::string header_value; std::string header_value;
response.headers.emplace();
while (response_headers->EnumerateHeaderLines(&iter, &header_name, while (response_headers->EnumerateHeaderLines(&iter, &header_name,
&header_value)) { &header_value)) {
oldhttp::HttpHeader header; oldhttp::HttpHeader header;
header.name = header_name; header.name = header_name;
header.value = header_value; header.value = header_value;
response.headers.push_back(header); response.headers->push_back(header);
} }
} }
......
...@@ -26,7 +26,7 @@ fuchsia::fonts::ProviderSyncPtr RunTestProviderWithTestFonts( ...@@ -26,7 +26,7 @@ fuchsia::fonts::ProviderSyncPtr RunTestProviderWithTestFonts(
// fonts, which must be bundled in the calling process' package. // fonts, which must be bundled in the calling process' package.
fuchsia::sys::LaunchInfo launch_info; fuchsia::sys::LaunchInfo launch_info;
launch_info.url = "fuchsia-pkg://fuchsia.com/fonts#meta/fonts.cmx"; launch_info.url = "fuchsia-pkg://fuchsia.com/fonts#meta/fonts.cmx";
launch_info.arguments.reset( launch_info.arguments.emplace(
{"--no-default-fonts", {"--no-default-fonts",
"--font-manifest=/test_fonts/fuchsia_test_fonts_manifest.json"}); "--font-manifest=/test_fonts/fuchsia_test_fonts_manifest.json"});
launch_info.flat_namespace = fuchsia::sys::FlatNamespace::New(); launch_info.flat_namespace = fuchsia::sys::FlatNamespace::New();
......
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