Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(602)

Unified Diff: ios/web/webui/web_ui_mojo_inttest.mm

Issue 2916473002: [ObjC ARC] Converts ios/web:web to ARC. (Closed)
Patch Set: Fixing silly mistake Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/web_state/wk_web_view_security_util.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/webui/web_ui_mojo_inttest.mm
diff --git a/ios/web/webui/web_ui_mojo_inttest.mm b/ios/web/webui/web_ui_mojo_inttest.mm
index 97916af543d08a09094c16c7d477a5742fa9ed32..d45957fbf75fe5ccc5a9f0fe5d9351cacde44171 100644
--- a/ios/web/webui/web_ui_mojo_inttest.mm
+++ b/ios/web/webui/web_ui_mojo_inttest.mm
@@ -137,13 +137,22 @@ class TestWebUIControllerFactory : public WebUIIOSControllerFactory {
class WebUIMojoTest : public WebIntTest {
protected:
void SetUp() override {
- WebIntTest::SetUp();
- ui_handler_ = base::MakeUnique<TestUIHandler>();
- web::WebState::CreateParams params(GetBrowserState());
- web_state_ = base::MakeUnique<web::WebStateImpl>(params);
- web_state_->GetNavigationManagerImpl().InitializeSession();
- WebUIIOSControllerFactory::RegisterFactory(
- new TestWebUIControllerFactory(ui_handler_.get()));
+ @autoreleasepool {
+ WebIntTest::SetUp();
+ ui_handler_ = base::MakeUnique<TestUIHandler>();
+ web::WebState::CreateParams params(GetBrowserState());
+ web_state_ = base::MakeUnique<web::WebStateImpl>(params);
+ web_state_->GetNavigationManagerImpl().InitializeSession();
+ WebUIIOSControllerFactory::RegisterFactory(
+ new TestWebUIControllerFactory(ui_handler_.get()));
+ }
+ }
+
+ void TearDown() override {
+ @autoreleasepool {
+ web_state_.reset();
+ WebIntTest::TearDown();
+ }
}
// Returns WebState which loads test WebUI page.
@@ -166,31 +175,33 @@ class WebUIMojoTest : public WebIntTest {
#endif
// TODO(crbug.com/720098): Enable this test on device.
TEST_F(WebUIMojoTest, MAYBE_MessageExchange) {
- web_state()->SetWebUsageEnabled(true);
- web_state()->GetView(); // WebState won't load URL without view.
- GURL url(
- url::SchemeHostPort(kTestWebUIScheme, kTestWebUIURLHost, 0).Serialize());
- NavigationManager::WebLoadParams load_params(url);
- web_state()->GetNavigationManager()->LoadURLWithParams(load_params);
-
- // Wait until |TestUIHandler| receives "fin" message from WebUI page.
- bool fin_received = testing::WaitUntilConditionOrTimeout(kMessageTimeout, ^{
- // Flush any pending tasks. Don't RunUntilIdle() because
- // RunUntilIdle() is incompatible with mojo::SimpleWatcher's
- // automatic arming behavior, which Mojo JS still depends upon.
- //
- // TODO(crbug.com/701875): Introduce the full watcher API to JS and get rid
- // of this hack.
- base::RunLoop loop;
- base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
- loop.QuitClosure());
- loop.Run();
- return test_ui_handler()->IsFinReceived();
- });
-
- ASSERT_TRUE(fin_received);
- EXPECT_FALSE(web_state()->IsLoading());
- EXPECT_EQ(url, web_state()->GetLastCommittedURL());
+ @autoreleasepool {
+ web_state()->SetWebUsageEnabled(true);
+ web_state()->GetView(); // WebState won't load URL without view.
+ GURL url(url::SchemeHostPort(kTestWebUIScheme, kTestWebUIURLHost, 0)
+ .Serialize());
+ NavigationManager::WebLoadParams load_params(url);
+ web_state()->GetNavigationManager()->LoadURLWithParams(load_params);
+
+ // Wait until |TestUIHandler| receives "fin" message from WebUI page.
+ bool fin_received = testing::WaitUntilConditionOrTimeout(kMessageTimeout, ^{
+ // Flush any pending tasks. Don't RunUntilIdle() because
+ // RunUntilIdle() is incompatible with mojo::SimpleWatcher's
+ // automatic arming behavior, which Mojo JS still depends upon.
+ //
+ // TODO(crbug.com/701875): Introduce the full watcher API to JS and get
+ // rid of this hack.
+ base::RunLoop loop;
+ base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
+ loop.QuitClosure());
+ loop.Run();
+ return test_ui_handler()->IsFinReceived();
+ });
+
+ ASSERT_TRUE(fin_received);
+ EXPECT_FALSE(web_state()->IsLoading());
+ EXPECT_EQ(url, web_state()->GetLastCommittedURL());
+ }
}
} // namespace web
« no previous file with comments | « ios/web/web_state/wk_web_view_security_util.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698