OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/shell/renderer/webkit_test_runner.h" | 5 #include "content/shell/renderer/webkit_test_runner.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <clocale> | 8 #include <clocale> |
9 #include <cmath> | 9 #include <cmath> |
10 | 10 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 WebURL WebKitTestRunner::localFileToDataURL(const WebURL& file_url) { | 285 WebURL WebKitTestRunner::localFileToDataURL(const WebURL& file_url) { |
286 base::FilePath local_path; | 286 base::FilePath local_path; |
287 if (!net::FileURLToFilePath(file_url, &local_path)) | 287 if (!net::FileURLToFilePath(file_url, &local_path)) |
288 return WebURL(); | 288 return WebURL(); |
289 | 289 |
290 std::string contents; | 290 std::string contents; |
291 Send(new ShellViewHostMsg_ReadFileToString( | 291 Send(new ShellViewHostMsg_ReadFileToString( |
292 routing_id(), local_path, &contents)); | 292 routing_id(), local_path, &contents)); |
293 | 293 |
294 std::string contents_base64; | 294 std::string contents_base64; |
295 if (!base::Base64Encode(contents, &contents_base64)) | 295 base::Base64Encode(contents, &contents_base64); |
296 return WebURL(); | |
297 | 296 |
298 const char data_url_prefix[] = "data:text/css:charset=utf-8;base64,"; | 297 const char data_url_prefix[] = "data:text/css:charset=utf-8;base64,"; |
299 return WebURL(GURL(data_url_prefix + contents_base64)); | 298 return WebURL(GURL(data_url_prefix + contents_base64)); |
300 } | 299 } |
301 | 300 |
302 WebURL WebKitTestRunner::rewriteLayoutTestsURL(const std::string& utf8_url) { | 301 WebURL WebKitTestRunner::rewriteLayoutTestsURL(const std::string& utf8_url) { |
303 const char kPrefix[] = "file:///tmp/LayoutTests/"; | 302 const char kPrefix[] = "file:///tmp/LayoutTests/"; |
304 const int kPrefixLen = arraysize(kPrefix) - 1; | 303 const int kPrefixLen = arraysize(kPrefix) - 1; |
305 | 304 |
306 if (utf8_url.compare(0, kPrefixLen, kPrefix, kPrefixLen)) | 305 if (utf8_url.compare(0, kPrefixLen, kPrefix, kPrefixLen)) |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 WebURLRequest(GURL(kAboutBlankURL))); | 694 WebURLRequest(GURL(kAboutBlankURL))); |
696 Send(new ShellViewHostMsg_ResetDone(routing_id())); | 695 Send(new ShellViewHostMsg_ResetDone(routing_id())); |
697 } | 696 } |
698 | 697 |
699 void WebKitTestRunner::OnNotifyDone() { | 698 void WebKitTestRunner::OnNotifyDone() { |
700 render_view()->GetWebView()->mainFrame()->executeScript( | 699 render_view()->GetWebView()->mainFrame()->executeScript( |
701 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); | 700 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); |
702 } | 701 } |
703 | 702 |
704 } // namespace content | 703 } // namespace content |
OLD | NEW |