| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file contains the implementation of TestWebViewDelegate, which serves | 5 // This file contains the implementation of TestWebViewDelegate, which serves |
| 6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to | 6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to |
| 7 // have initialized a MessageLoop before these methods are called. | 7 // have initialized a MessageLoop before these methods are called. |
| 8 | 8 |
| 9 #include "webkit/tools/test_shell/test_webview_delegate.h" | 9 #include "webkit/tools/test_shell/test_webview_delegate.h" |
| 10 | 10 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 const char* kIllegalString = "illegal value"; | 130 const char* kIllegalString = "illegal value"; |
| 131 | 131 |
| 132 int next_page_id_ = 1; | 132 int next_page_id_ = 1; |
| 133 | 133 |
| 134 // Used to write a platform neutral file:/// URL by only taking the filename | 134 // Used to write a platform neutral file:/// URL by only taking the filename |
| 135 // (e.g., converts "file:///tmp/foo.txt" to just "foo.txt"). | 135 // (e.g., converts "file:///tmp/foo.txt" to just "foo.txt"). |
| 136 std::string UrlSuitableForTestResult(const std::string& url) { | 136 std::string UrlSuitableForTestResult(const std::string& url) { |
| 137 if (url.empty() || std::string::npos == url.find("file://")) | 137 if (url.empty() || std::string::npos == url.find("file://")) |
| 138 return url; | 138 return url; |
| 139 | 139 |
| 140 // TODO: elsewhere in the codebase we use net::FormatUrl() for this. |
| 140 std::string filename = | 141 std::string filename = |
| 141 WideToUTF8(file_util::GetFilenameFromPath(UTF8ToWide(url))); | 142 WideToUTF8(FilePath::FromWStringHack(UTF8ToWide(url)) |
| 143 .BaseName().ToWStringHack()); |
| 142 if (filename.empty()) | 144 if (filename.empty()) |
| 143 return "file:"; // A WebKit test has this in its expected output. | 145 return "file:"; // A WebKit test has this in its expected output. |
| 144 return filename; | 146 return filename; |
| 145 } | 147 } |
| 146 | 148 |
| 147 // Used to write a platform neutral file:/// URL by taking the | 149 // Used to write a platform neutral file:/// URL by taking the |
| 148 // filename and its directory. (e.g., converts | 150 // filename and its directory. (e.g., converts |
| 149 // "file:///tmp/foo/bar.txt" to just "bar.txt"). | 151 // "file:///tmp/foo/bar.txt" to just "bar.txt"). |
| 150 std::string DescriptionSuitableForTestResult(const std::string& url) { | 152 std::string DescriptionSuitableForTestResult(const std::string& url) { |
| 151 if (url.empty() || std::string::npos == url.find("file://")) | 153 if (url.empty() || std::string::npos == url.find("file://")) |
| (...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 } | 1298 } |
| 1297 | 1299 |
| 1298 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { | 1300 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { |
| 1299 fake_rect_ = rect; | 1301 fake_rect_ = rect; |
| 1300 using_fake_rect_ = true; | 1302 using_fake_rect_ = true; |
| 1301 } | 1303 } |
| 1302 | 1304 |
| 1303 WebRect TestWebViewDelegate::fake_window_rect() { | 1305 WebRect TestWebViewDelegate::fake_window_rect() { |
| 1304 return fake_rect_; | 1306 return fake_rect_; |
| 1305 } | 1307 } |
| OLD | NEW |