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

Side by Side Diff: ios/web/webui/web_ui_mojo_inttest.mm

Issue 2027733003: [ios Mojo] Enabled Mojo WebUI by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « ios/web/web_state/ui/crw_web_controller.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <memory> 5 #include <memory>
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #import "base/test/ios/wait_util.h" 8 #import "base/test/ios/wait_util.h"
9 #include "ios/public/provider/web/web_ui_ios_controller.h" 9 #include "ios/public/provider/web/web_ui_ios_controller.h"
10 #include "ios/public/provider/web/web_ui_ios_controller_factory.h" 10 #include "ios/public/provider/web/web_ui_ios_controller_factory.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 private: 141 private:
142 std::unique_ptr<WebStateImpl> web_state_; 142 std::unique_ptr<WebStateImpl> web_state_;
143 std::unique_ptr<TestUIHandler> ui_handler_; 143 std::unique_ptr<TestUIHandler> ui_handler_;
144 }; 144 };
145 145
146 // Tests that JS can send messages to the native code and vice versa. 146 // Tests that JS can send messages to the native code and vice versa.
147 // TestUIHandler is used for communication and test suceeds only when 147 // TestUIHandler is used for communication and test suceeds only when
148 // |TestUIHandler| sucessfully receives "ack" message from WebUI page. 148 // |TestUIHandler| sucessfully receives "ack" message from WebUI page.
149 TEST_F(WebUIMojoTest, MessageExchange) { 149 TEST_F(WebUIMojoTest, MessageExchange) {
150 web_state()->SetWebUsageEnabled(true); 150 web_state()->SetWebUsageEnabled(true);
151 web_state()->GetWebController().useMojoForWebUI = YES;
152 web_state()->GetView(); // WebState won't load URL without view. 151 web_state()->GetView(); // WebState won't load URL without view.
153 NavigationManager::WebLoadParams load_params(GURL( 152 NavigationManager::WebLoadParams load_params(GURL(
154 url::SchemeHostPort(kTestWebUIScheme, kTestWebUIURLHost, 0).Serialize())); 153 url::SchemeHostPort(kTestWebUIScheme, kTestWebUIURLHost, 0).Serialize()));
155 web_state()->GetNavigationManager()->LoadURLWithParams(load_params); 154 web_state()->GetNavigationManager()->LoadURLWithParams(load_params);
156 155
157 // Wait until |TestUIHandler| receives "ack" message from WebUI page. 156 // Wait until |TestUIHandler| receives "ack" message from WebUI page.
158 base::test::ios::WaitUntilCondition(^{ 157 base::test::ios::WaitUntilCondition(^{
159 base::RunLoop().RunUntilIdle(); 158 base::RunLoop().RunUntilIdle();
160 return test_ui_handler()->IsFinReceived(); 159 return test_ui_handler()->IsFinReceived();
161 }); 160 });
162 } 161 }
163 162
164 } // namespace web 163 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/web_state/ui/crw_web_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698