OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "ios/web/webui/crw_web_ui_manager.h" | 5 #import "ios/web/webui/crw_web_ui_manager.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #import "base/mac/scoped_nsobject.h" | 12 #import "base/mac/scoped_nsobject.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
17 #import "base/strings/sys_string_conversions.h" | 17 #import "base/strings/sys_string_conversions.h" |
18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
19 #include "base/values.h" | 19 #include "base/values.h" |
20 #include "ios/web/public/test/scoped_testing_web_client.h" | 20 #include "ios/web/public/test/scoped_testing_web_client.h" |
21 #include "ios/web/public/test/test_browser_state.h" | 21 #include "ios/web/public/test/test_browser_state.h" |
22 #import "ios/web/public/test/test_web_client.h" | 22 #import "ios/web/public/test/test_web_client.h" |
23 #include "ios/web/public/test/web_test.h" | 23 #include "ios/web/public/test/web_test.h" |
24 #include "ios/web/web_state/web_state_impl.h" | 24 #import "ios/web/web_state/web_state_impl.h" |
25 #import "ios/web/webui/crw_web_ui_page_builder.h" | 25 #import "ios/web/webui/crw_web_ui_page_builder.h" |
26 #include "ios/web/webui/url_fetcher_block_adapter.h" | 26 #import "ios/web/webui/url_fetcher_block_adapter.h" |
27 #include "testing/gmock/include/gmock/gmock.h" | 27 #include "testing/gmock/include/gmock/gmock.h" |
28 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
29 #include "testing/gtest_mac.h" | 29 #import "testing/gtest_mac.h" |
30 | 30 |
31 namespace web { | 31 namespace web { |
32 | 32 |
33 // Path for test favicon file. | 33 // Path for test favicon file. |
34 const char kFaviconPath[] = "ios/web/test/data/testfavicon.png"; | 34 const char kFaviconPath[] = "ios/web/test/data/testfavicon.png"; |
35 // URL for mock WebUI page. | 35 // URL for mock WebUI page. |
36 const char kTestWebUIUrl[] = "testwebui://test/"; | 36 const char kTestWebUIUrl[] = "testwebui://test/"; |
37 // URL for mock favicon. | 37 // URL for mock favicon. |
38 const char kFaviconUrl[] = "testwebui://favicon/"; | 38 const char kFaviconUrl[] = "testwebui://favicon/"; |
39 // Name of test Mojo module. | 39 // Name of test Mojo module. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 "%s__crWeb.webUIModuleLoadNotifier.moduleLoadCompleted(\"%s\", \"%s\");", | 165 "%s__crWeb.webUIModuleLoadNotifier.moduleLoadCompleted(\"%s\", \"%s\");", |
166 base::SysNSStringToUTF8(kMojoModule).c_str(), kMojoModuleName, | 166 base::SysNSStringToUTF8(kMojoModule).c_str(), kMojoModuleName, |
167 kTestLoadId); | 167 kTestLoadId); |
168 | 168 |
169 EXPECT_CALL(*web_state_impl_, | 169 EXPECT_CALL(*web_state_impl_, |
170 ExecuteJavaScript(base::UTF8ToUTF16(expected_javascript))); | 170 ExecuteJavaScript(base::UTF8ToUTF16(expected_javascript))); |
171 web_state_impl_->OnScriptCommandReceived("webui.loadMojo", message, | 171 web_state_impl_->OnScriptCommandReceived("webui.loadMojo", message, |
172 GURL(kTestWebUIUrl), false); | 172 GURL(kTestWebUIUrl), false); |
173 } | 173 } |
174 } // namespace web | 174 } // namespace web |
OLD | NEW |