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

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

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan Created 4 years, 1 month 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
OLDNEW
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"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 completion_handler_([completion_handler copy]) {} 72 completion_handler_([completion_handler copy]) {}
73 73
74 void Start() override { 74 void Start() override {
75 if (url_.spec() == kFaviconUrl) { 75 if (url_.spec() == kFaviconUrl) {
76 base::FilePath favicon_path; 76 base::FilePath favicon_path;
77 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &favicon_path)); 77 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &favicon_path));
78 favicon_path = favicon_path.AppendASCII(kFaviconPath); 78 favicon_path = favicon_path.AppendASCII(kFaviconPath);
79 NSData* favicon = [NSData 79 NSData* favicon = [NSData
80 dataWithContentsOfFile:base::SysUTF8ToNSString(favicon_path.value())]; 80 dataWithContentsOfFile:base::SysUTF8ToNSString(favicon_path.value())];
81 completion_handler_.get()(favicon, this); 81 completion_handler_.get()(favicon, this);
82 } else if (url_.path().find(kMojoModuleName) != std::string::npos) { 82 } else if (url_.path().find(kMojoModuleName) != base::StringPiece::npos) {
83 completion_handler_.get()( 83 completion_handler_.get()(
84 [kMojoModule dataUsingEncoding:NSUTF8StringEncoding], this); 84 [kMojoModule dataUsingEncoding:NSUTF8StringEncoding], this);
85 85
86 } else if (url_.scheme().find("test") != std::string::npos) { 86 } else if (url_.scheme().find("test") != std::string::npos) {
87 completion_handler_.get()([kHtml dataUsingEncoding:NSUTF8StringEncoding], 87 completion_handler_.get()([kHtml dataUsingEncoding:NSUTF8StringEncoding],
88 this); 88 this);
89 } else { 89 } else {
90 NOTREACHED(); 90 NOTREACHED();
91 } 91 }
92 } 92 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 "%s__crWeb.webUIModuleLoadNotifier.moduleLoadCompleted(\"%s\", \"%s\");", 195 "%s__crWeb.webUIModuleLoadNotifier.moduleLoadCompleted(\"%s\", \"%s\");",
196 base::SysNSStringToUTF8(kMojoModule).c_str(), kMojoModuleName, 196 base::SysNSStringToUTF8(kMojoModule).c_str(), kMojoModuleName,
197 kTestLoadId); 197 kTestLoadId);
198 198
199 EXPECT_CALL(*web_state_impl_, 199 EXPECT_CALL(*web_state_impl_,
200 ExecuteJavaScript(base::UTF8ToUTF16(expected_javascript))); 200 ExecuteJavaScript(base::UTF8ToUTF16(expected_javascript)));
201 web_state_impl_->OnScriptCommandReceived("webui.loadMojo", message, 201 web_state_impl_->OnScriptCommandReceived("webui.loadMojo", message,
202 GURL(kTestWebUIUrl), false); 202 GURL(kTestWebUIUrl), false);
203 } 203 }
204 } // namespace web 204 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/public/test/response_providers/file_based_response_provider_impl.mm ('k') | net/base/filename_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698