Commit f495b4a9 authored by Kevin Marshall's avatar Kevin Marshall Committed by Commit Bot

[Fuchsia] Use Interface* instead of InterfacePtr* in test code.

LoadUrlAndExpectResponse's use of InterfacePtr is unnecessarily
restrictive given that the function body doesn't interact with channel-
level details directly.

Using an Interface raw pointer is a better fit, and allows callers to
pass in NavigationControllers when a NavigationControllerPtr isn't
available.

Change-Id: Ib1a1fbbc3e9373219971d4290deecf3f33904908
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1590959
Auto-Submit: Kevin Marshall <kmarshall@chromium.org>
Reviewed-by: default avatarFabrice de Gans-Riberi <fdegans@chromium.org>
Commit-Queue: Kevin Marshall <kmarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#656445}
parent 228717e4
......@@ -12,16 +12,16 @@
namespace cr_fuchsia {
bool LoadUrlAndExpectResponse(
fuchsia::web::NavigationControllerPtr* navigation_controller,
fuchsia::web::NavigationController* navigation_controller,
fuchsia::web::LoadUrlParams load_url_params,
std::string url) {
DCHECK(navigation_controller);
base::RunLoop run_loop;
ResultReceiver<fuchsia::web::NavigationController_LoadUrl_Result> result(
run_loop.QuitClosure());
(*navigation_controller)
->LoadUrl(url, std::move(load_url_params),
CallbackToFitFunction(result.GetReceiveCallback()));
navigation_controller->LoadUrl(
url, std::move(load_url_params),
CallbackToFitFunction(result.GetReceiveCallback()));
run_loop.Run();
return result->is_response();
}
......
......@@ -13,7 +13,7 @@ namespace cr_fuchsia {
// after the load is completed. Returns true if the load was successful, false
// otherwise.
bool LoadUrlAndExpectResponse(
fuchsia::web::NavigationControllerPtr* navigation_controller,
fuchsia::web::NavigationController* navigation_controller,
fuchsia::web::LoadUrlParams load_url_params,
std::string url);
......
......@@ -92,8 +92,9 @@ IN_PROC_BROWSER_TEST_F(ContextImplTest, VerifyPersistentCookieStore) {
fuchsia::web::NavigationControllerPtr navigation_controller;
frame->GetNavigationController(navigation_controller.NewRequest());
cr_fuchsia::LoadUrlAndExpectResponse(
&navigation_controller, fuchsia::web::LoadUrlParams(), cookie_url.spec());
cr_fuchsia::LoadUrlAndExpectResponse(navigation_controller.get(),
fuchsia::web::LoadUrlParams(),
cookie_url.spec());
navigation_listener_.RunUntilUrlEquals(cookie_url);
auto cookies = GetCookies();
......@@ -146,7 +147,7 @@ IN_PROC_BROWSER_TEST_F(IncognitoContextImplTest, NavigateFrame) {
frame->GetNavigationController(controller.NewRequest());
EXPECT_TRUE(cr_fuchsia::LoadUrlAndExpectResponse(
&controller, fuchsia::web::LoadUrlParams(), url::kAboutBlankURL));
controller.get(), fuchsia::web::LoadUrlParams(), url::kAboutBlankURL));
navigation_listener_.RunUntilUrlEquals(GURL(url::kAboutBlankURL));
frame.Unbind();
......@@ -161,7 +162,7 @@ IN_PROC_BROWSER_TEST_F(IncognitoContextImplTest, VerifyInMemoryCookieStore) {
frame->GetNavigationController(controller.NewRequest());
EXPECT_TRUE(cr_fuchsia::LoadUrlAndExpectResponse(
&controller, fuchsia::web::LoadUrlParams(), cookie_url.spec()));
controller.get(), fuchsia::web::LoadUrlParams(), cookie_url.spec()));
navigation_listener_.RunUntilUrlEquals(cookie_url);
auto cookies = GetCookies();
......
......@@ -85,7 +85,7 @@ IN_PROC_BROWSER_TEST_F(NamedMessagePortConnectorTest,
base::Unretained(&message_port)),
frame_.get());
EXPECT_TRUE(cr_fuchsia::LoadUrlAndExpectResponse(
&controller, fuchsia::web::LoadUrlParams(), test_url.spec()));
controller.get(), fuchsia::web::LoadUrlParams(), test_url.spec()));
navigation_listener_.RunUntilUrlEquals(test_url);
receive_port_run_loop.Run();
......@@ -122,7 +122,7 @@ IN_PROC_BROWSER_TEST_F(NamedMessagePortConnectorTest,
run_loop.Quit();
});
EXPECT_TRUE(cr_fuchsia::LoadUrlAndExpectResponse(
&controller, fuchsia::web::LoadUrlParams(), "about:blank"));
controller.get(), fuchsia::web::LoadUrlParams(), "about:blank"));
run_loop.Run();
}
......
......@@ -147,7 +147,7 @@ IN_PROC_BROWSER_TEST_F(QueryableDataBindingsTest, VariousTypes) {
frame_->GetNavigationController(controller.NewRequest());
frame_->SetJavaScriptLogLevel(fuchsia::web::ConsoleLogLevel::INFO);
EXPECT_TRUE(cr_fuchsia::LoadUrlAndExpectResponse(
&controller, fuchsia::web::LoadUrlParams(), test_url_.spec()));
controller.get(), fuchsia::web::LoadUrlParams(), test_url_.spec()));
navigation_listener_.RunUntilUrlEquals(test_url_);
EXPECT_EQ(CallQueryPlatformValue("string"), "\"foo\"");
......@@ -166,7 +166,7 @@ IN_PROC_BROWSER_TEST_F(QueryableDataBindingsTest, NoValues) {
frame_->GetNavigationController(controller.NewRequest());
frame_->SetJavaScriptLogLevel(fuchsia::web::ConsoleLogLevel::INFO);
EXPECT_TRUE(cr_fuchsia::LoadUrlAndExpectResponse(
&controller, fuchsia::web::LoadUrlParams(), test_url_.spec()));
controller.get(), fuchsia::web::LoadUrlParams(), test_url_.spec()));
navigation_listener_.RunUntilUrlEquals(test_url_);
EXPECT_EQ(CallQueryPlatformValue("string"), "null");
......@@ -186,7 +186,7 @@ IN_PROC_BROWSER_TEST_F(QueryableDataBindingsTest, AtPageRuntime) {
frame_->GetNavigationController(controller.NewRequest());
frame_->SetJavaScriptLogLevel(fuchsia::web::ConsoleLogLevel::INFO);
EXPECT_TRUE(cr_fuchsia::LoadUrlAndExpectResponse(
&controller, fuchsia::web::LoadUrlParams(), test_url_.spec()));
controller.get(), fuchsia::web::LoadUrlParams(), test_url_.spec()));
navigation_listener_.RunUntilUrlEquals(test_url_);
SynchronizeWithPage();
......@@ -224,7 +224,7 @@ IN_PROC_BROWSER_TEST_F(QueryableDataBindingsTest, AtPageLoad) {
frame_->GetNavigationController(controller.NewRequest());
frame_->SetJavaScriptLogLevel(fuchsia::web::ConsoleLogLevel::INFO);
EXPECT_TRUE(cr_fuchsia::LoadUrlAndExpectResponse(
&controller, fuchsia::web::LoadUrlParams(), test_url_.spec()));
controller.get(), fuchsia::web::LoadUrlParams(), test_url_.spec()));
navigation_listener_.RunUntilUrlEquals(test_url_);
SynchronizeWithPage();
......
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