Commit 55d9706a authored by Mohamed Amir Yosef's avatar Mohamed Amir Yosef Committed by Commit Bot

[Autofill] Instantiate FillResponseWhenNoErrors for ApiTestEnv

Before the patch:
Api_FillsResponseWhenNoErrors was mistakenly instantiated
FillResponseWhenNoErrors against the LegacyTestEnv.

This patch correctly instatates it against ApiTestEnv and does
the required modification to make it pass.

Bug: 1114655
Change-Id: I99a8463615069d3307a84190bae383e92a309c06
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2404927Reviewed-by: default avatarDominic Battré <battre@chromium.org>
Commit-Queue: Mohamed Amir Yosef <mamir@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806116}
parent 2424e12a
...@@ -646,9 +646,15 @@ void FillResponseWhenNoErrors(RequestType request_type) { ...@@ -646,9 +646,15 @@ void FillResponseWhenNoErrors(RequestType request_type) {
std::string http_text_response; std::string http_text_response;
ASSERT_TRUE(TestEnv::GetServerResponseForQuery( ASSERT_TRUE(TestEnv::GetServerResponseForQuery(
cache_replayer, request_response_pairs[0].first, &http_text_response)); cache_replayer, request_response_pairs[0].first, &http_text_response));
AutofillQueryResponseContents response_from_cache; std::string body = SplitHTTP(http_text_response).second;
ASSERT_TRUE(response_from_cache.ParseFromString( if (std::is_same<TestEnv, ApiTestEnv>::value) {
SplitHTTP(http_text_response).second)); // The Api Environment expects the response to be base64 encoded.
std::string tmp;
ASSERT_TRUE(base::Base64Decode(body, &tmp));
body = tmp;
}
typename TestEnv::Env::Response response_from_cache;
ASSERT_TRUE(response_from_cache.ParseFromString(body));
} }
TEST_P(AutofillCacheReplayerGetResponseForQueryTest, TEST_P(AutofillCacheReplayerGetResponseForQueryTest,
...@@ -658,7 +664,7 @@ TEST_P(AutofillCacheReplayerGetResponseForQueryTest, ...@@ -658,7 +664,7 @@ TEST_P(AutofillCacheReplayerGetResponseForQueryTest,
TEST_P(AutofillCacheReplayerGetResponseForQueryTest, TEST_P(AutofillCacheReplayerGetResponseForQueryTest,
Api_FillsResponseWhenNoErrors) { Api_FillsResponseWhenNoErrors) {
FillResponseWhenNoErrors<LegacyTestEnv>(GetParam()); FillResponseWhenNoErrors<ApiTestEnv>(GetParam());
} }
INSTANTIATE_TEST_SUITE_P(GetResponseForQueryParameterizeTest, INSTANTIATE_TEST_SUITE_P(GetResponseForQueryParameterizeTest,
......
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