OLD | NEW |
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 #import "ios/web/public/navigation_manager.h" | 9 #import "ios/web/public/navigation_manager.h" |
10 #include "ios/web/public/web_ui_ios_data_source.h" | 10 #include "ios/web/public/web_ui_ios_data_source.h" |
11 #include "ios/web/public/webui/web_ui_ios_controller.h" | 11 #include "ios/web/public/webui/web_ui_ios_controller.h" |
12 #include "ios/web/public/webui/web_ui_ios_controller_factory.h" | 12 #include "ios/web/public/webui/web_ui_ios_controller_factory.h" |
13 #include "ios/web/test/grit/test_resources.h" | 13 #include "ios/web/test/grit/test_resources.h" |
14 #include "ios/web/test/mojo_test.mojom.h" | 14 #include "ios/web/test/mojo_test.mojom.h" |
15 #include "ios/web/test/test_url_constants.h" | 15 #include "ios/web/test/test_url_constants.h" |
16 #import "ios/web/test/web_int_test.h" | 16 #import "ios/web/test/web_int_test.h" |
17 #import "ios/web/web_state/ui/crw_web_controller.h" | 17 #import "ios/web/web_state/ui/crw_web_controller.h" |
18 #import "ios/web/web_state/web_state_impl.h" | 18 #import "ios/web/web_state/web_state_impl.h" |
19 #include "mojo/public/cpp/bindings/binding_set.h" | 19 #include "mojo/public/cpp/bindings/binding_set.h" |
| 20 #include "services/shell/public/cpp/identity.h" |
20 #include "services/shell/public/cpp/interface_registry.h" | 21 #include "services/shell/public/cpp/interface_registry.h" |
21 #include "url/gurl.h" | 22 #include "url/gurl.h" |
22 #include "url/scheme_host_port.h" | 23 #include "url/scheme_host_port.h" |
23 | 24 |
24 namespace web { | 25 namespace web { |
25 | 26 |
26 namespace { | 27 namespace { |
27 | 28 |
28 // Hostname for test WebUI page. | 29 // Hostname for test WebUI page. |
29 const char kTestWebUIURLHost[] = "testwebui"; | 30 const char kTestWebUIURLHost[] = "testwebui"; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 DCHECK(syn_received_); | 62 DCHECK(syn_received_); |
62 DCHECK(!fin_received_); | 63 DCHECK(!fin_received_); |
63 fin_received_ = true; | 64 fin_received_ = true; |
64 } else { | 65 } else { |
65 NOTREACHED(); | 66 NOTREACHED(); |
66 } | 67 } |
67 } | 68 } |
68 | 69 |
69 private: | 70 private: |
70 // shell::InterfaceFactory overrides. | 71 // shell::InterfaceFactory overrides. |
71 void Create(shell::Connection* connection, | 72 void Create(const shell::Identity& remote_identity, |
72 mojo::InterfaceRequest<TestUIHandlerMojo> request) override { | 73 mojo::InterfaceRequest<TestUIHandlerMojo> request) override { |
73 bindings_.AddBinding(this, std::move(request)); | 74 bindings_.AddBinding(this, std::move(request)); |
74 } | 75 } |
75 | 76 |
76 mojo::BindingSet<TestUIHandlerMojo> bindings_; | 77 mojo::BindingSet<TestUIHandlerMojo> bindings_; |
77 TestPagePtr page_ = nullptr; | 78 TestPagePtr page_ = nullptr; |
78 // |true| if "syn" has been received. | 79 // |true| if "syn" has been received. |
79 bool syn_received_ = false; | 80 bool syn_received_ = false; |
80 // |true| if "fin" has been received. | 81 // |true| if "fin" has been received. |
81 bool fin_received_ = false; | 82 bool fin_received_ = false; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 web_state()->GetNavigationManager()->LoadURLWithParams(load_params); | 158 web_state()->GetNavigationManager()->LoadURLWithParams(load_params); |
158 | 159 |
159 // Wait until |TestUIHandler| receives "ack" message from WebUI page. | 160 // Wait until |TestUIHandler| receives "ack" message from WebUI page. |
160 base::test::ios::WaitUntilCondition(^{ | 161 base::test::ios::WaitUntilCondition(^{ |
161 base::RunLoop().RunUntilIdle(); | 162 base::RunLoop().RunUntilIdle(); |
162 return test_ui_handler()->IsFinReceived(); | 163 return test_ui_handler()->IsFinReceived(); |
163 }); | 164 }); |
164 } | 165 } |
165 | 166 |
166 } // namespace web | 167 } // namespace web |
OLD | NEW |