summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/automation/url_request_mock_http_job.cc5
-rw-r--r--chrome/browser/automation/url_request_mock_net_error_job.cc4
-rw-r--r--chrome/browser/browser.cc2
-rw-r--r--chrome/browser/browser_uitest.cc28
-rw-r--r--chrome/browser/chrome_plugin_host.cc5
-rw-r--r--chrome/browser/crash_recovery_uitest.cc5
-rw-r--r--chrome/browser/download/download_manager.h1
-rw-r--r--chrome/browser/download/save_package.cc2
-rw-r--r--chrome/browser/extensions/user_script_master.cc2
-rw-r--r--chrome/browser/history/redirect_uitest.cc22
-rw-r--r--chrome/browser/iframe_uitest.cc11
-rw-r--r--chrome/browser/metrics/metrics_service_uitest.cc9
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc5
-rw-r--r--chrome/browser/renderer_host/renderer_security_policy.h1
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.cc6
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc4
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc3
-rw-r--r--chrome/browser/tab_restore_uitest.cc10
-rw-r--r--chrome/browser/views/constrained_window_impl_interactive_uitest.cc7
-rw-r--r--chrome/common/render_messages.h2
-rw-r--r--chrome/common/render_messages_internal.h1
-rw-r--r--chrome/common/resource_dispatcher.cc5
-rw-r--r--chrome/plugin/chrome_plugin_host.cc8
-rw-r--r--chrome/renderer/render_view.h1
-rw-r--r--chrome/test/accessibility/accessibility_tests.cc24
-rw-r--r--chrome/test/automation/automation_proxy_uitest.cc48
-rw-r--r--chrome/test/plugin/plugin_test.cpp7
-rw-r--r--chrome/test/selenium/selenium_test.cc3
-rw-r--r--chrome/test/tab_switching/tab_switching_test.cc19
-rw-r--r--chrome/test/ui/layout_plugin_uitest.cc4
-rw-r--r--chrome/test/ui/ui_test.cc2
-rw-r--r--net/base/net_util.cc12
-rw-r--r--net/base/net_util.h4
-rw-r--r--net/base/net_util_unittest.cc95
-rw-r--r--net/base/upload_data.h13
-rw-r--r--net/base/upload_data_stream.cc12
-rw-r--r--net/url_request/url_request.cc4
-rw-r--r--net/url_request/url_request.h5
-rw-r--r--net/url_request/url_request_file_job.cc2
-rw-r--r--net/url_request/url_request_unittest.cc25
-rw-r--r--webkit/glue/chrome_client_impl.cc8
-rw-r--r--webkit/glue/context_menu_unittest.cc9
-rw-r--r--webkit/glue/dom_operations_unittest.cc32
-rw-r--r--webkit/glue/dom_serializer_unittest.cc50
-rw-r--r--webkit/glue/iframe_redirect_unittest.cc9
-rw-r--r--webkit/glue/plugins/plugin_host.cc4
-rw-r--r--webkit/glue/resource_handle_impl.cc2
-rw-r--r--webkit/glue/resource_loader_bridge.h5
-rw-r--r--webkit/glue/weburlrequest_impl.cc5
-rw-r--r--webkit/glue/webview_delegate.h1
-rw-r--r--webkit/tools/test_shell/simple_resource_loader_bridge.cc2
-rw-r--r--webkit/tools/test_shell/test_shell_gtk.cc2
-rw-r--r--webkit/tools/test_shell/test_shell_test.cc14
-rw-r--r--webkit/tools/test_shell/test_shell_test.h9
54 files changed, 298 insertions, 282 deletions
diff --git a/chrome/browser/automation/url_request_mock_http_job.cc b/chrome/browser/automation/url_request_mock_http_job.cc
index 26a5cc7..4bb191a 100644
--- a/chrome/browser/automation/url_request_mock_http_job.cc
+++ b/chrome/browser/automation/url_request_mock_http_job.cc
@@ -32,10 +32,9 @@ URLRequestJob* URLRequestMockHTTPJob::Factory(URLRequest* request,
}
// Convert the file:/// URL to a path on disk.
- std::wstring file_path;
+ FilePath file_path;
net::FileURLToFilePath(GURL(WideToUTF8(file_url)), &file_path);
- return new URLRequestMockHTTPJob(request,
- FilePath::FromWStringHack(file_path));
+ return new URLRequestMockHTTPJob(request, file_path);
}
/* static */
diff --git a/chrome/browser/automation/url_request_mock_net_error_job.cc b/chrome/browser/automation/url_request_mock_net_error_job.cc
index e6ab51f..0b9a20a 100644
--- a/chrome/browser/automation/url_request_mock_net_error_job.cc
+++ b/chrome/browser/automation/url_request_mock_net_error_job.cc
@@ -54,11 +54,11 @@ URLRequestJob* URLRequestMockNetErrorJob::Factory(URLRequest* request,
file_url.append(mock_info.base);
file_url.append(UTF8ToWide(url.path()));
// Convert the file:/// URL to a path on disk.
- std::wstring file_path;
+ FilePath file_path;
net::FileURLToFilePath(GURL(WideToUTF8(file_url)), &file_path);
return new URLRequestMockNetErrorJob(request, mock_info.errors,
mock_info.ssl_cert,
- FilePath::FromWStringHack(file_path));
+ file_path);
}
URLRequestMockNetErrorJob::URLRequestMockNetErrorJob(URLRequest* request,
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 727d128..ab5037a 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1949,7 +1949,7 @@ void Browser::RenderWidgetShowing() {
// Browser, SelectFileDialog::Listener implementation:
void Browser::FileSelected(const FilePath& path, int index, void* params) {
- GURL file_url = net::FilePathToFileURL(path.ToWStringHack());
+ GURL file_url = net::FilePathToFileURL(path);
if (!file_url.is_empty())
OpenURL(file_url, GURL(), CURRENT_TAB, PageTransition::TYPED);
}
diff --git a/chrome/browser/browser_uitest.cc b/chrome/browser/browser_uitest.cc
index a30016a..3a05636 100644
--- a/chrome/browser/browser_uitest.cc
+++ b/chrome/browser/browser_uitest.cc
@@ -61,8 +61,8 @@ class VisibleBrowserTest : public UITest {
// Launch the app on a page with no title, check that the app title was set
// correctly.
TEST_F(BrowserTest, NoTitle) {
- std::wstring test_file = test_data_directory_;
- file_util::AppendToPath(&test_file, L"title1.html");
+ FilePath test_file(FilePath::FromWStringHack(test_data_directory_));
+ test_file = test_file.AppendASCII("title1.html");
NavigateToURL(net::FilePathToFileURL(test_file));
Sleep(sleep_timeout_ms()); // The browser lazily updates the title.
@@ -74,8 +74,8 @@ TEST_F(BrowserTest, NoTitle) {
// Launch the app, navigate to a page with a title, check that the app title
// was set correctly.
TEST_F(BrowserTest, Title) {
- std::wstring test_file = test_data_directory_;
- file_util::AppendToPath(&test_file, L"title2.html");
+ FilePath test_file(FilePath::FromWStringHack(test_data_directory_));
+ test_file = test_file.AppendASCII("title2.html");
NavigateToURL(net::FilePathToFileURL(test_file));
Sleep(sleep_timeout_ms()); // The browser lazily updates the title.
@@ -90,8 +90,8 @@ TEST_F(BrowserTest, Title) {
// had a hard limit of 31 processes and this test is mainly directed at
// verifying that we don't crash when we pass this limit.
TEST_F(BrowserTest, ThirtyFourTabs) {
- std::wstring test_file = test_data_directory_;
- file_util::AppendToPath(&test_file, L"title2.html");
+ FilePath test_file(FilePath::FromWStringHack(test_data_directory_));
+ test_file = test_file.AppendASCII("title2.html");
GURL url(net::FilePathToFileURL(test_file));
scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
// There is one initial tab.
@@ -116,8 +116,8 @@ TEST_F(BrowserTest, ThirtyFourTabs) {
// The browser should quit quickly if it receives a WM_ENDSESSION message.
TEST_F(BrowserTest, WindowsSessionEnd) {
- std::wstring test_file = test_data_directory_;
- file_util::AppendToPath(&test_file, L"title1.html");
+ FilePath test_file(FilePath::FromWStringHack(test_data_directory_));
+ test_file = test_file.AppendASCII("title1.html");
NavigateToURL(net::FilePathToFileURL(test_file));
Sleep(action_timeout_ms());
@@ -186,12 +186,12 @@ TEST_F(BrowserTest, NullOpenerRedirectForksProcess) {
scoped_refptr<HTTPTestServer> server =
HTTPTestServer::CreateServer(kDocRoot, NULL);
ASSERT_TRUE(NULL != server.get());
- std::wstring test_file(test_data_directory_);
+ FilePath test_file(FilePath::FromWStringHack(test_data_directory_));
scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
scoped_ptr<TabProxy> tab(window->GetActiveTab());
// Start with a file:// url
- file_util::AppendToPath(&test_file, L"title2.html");
+ test_file = test_file.AppendASCII("title2.html");
tab->NavigateToURL(net::FilePathToFileURL(test_file));
int orig_tab_count = -1;
ASSERT_TRUE(window->GetTabCount(&orig_tab_count));
@@ -226,12 +226,12 @@ TEST_F(BrowserTest, OtherRedirectsDontForkProcess) {
scoped_refptr<HTTPTestServer> server =
HTTPTestServer::CreateServer(kDocRoot, NULL);
ASSERT_TRUE(NULL != server.get());
- std::wstring test_file(test_data_directory_);
+ FilePath test_file(FilePath::FromWStringHack(test_data_directory_));
scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
scoped_ptr<TabProxy> tab(window->GetActiveTab());
// Start with a file:// url
- file_util::AppendToPath(&test_file, L"title2.html");
+ test_file = test_file.AppendASCII("title2.html");
tab->NavigateToURL(net::FilePathToFileURL(test_file));
int orig_tab_count = -1;
ASSERT_TRUE(window->GetTabCount(&orig_tab_count));
@@ -263,8 +263,8 @@ TEST_F(BrowserTest, OtherRedirectsDontForkProcess) {
}
TEST_F(VisibleBrowserTest, WindowOpenClose) {
- std::wstring test_file(test_data_directory_);
- file_util::AppendToPath(&test_file, L"window.close.html");
+ FilePath test_file(FilePath::FromWStringHack(test_data_directory_));
+ test_file = test_file.AppendASCII("window.close.html");
NavigateToURL(net::FilePathToFileURL(test_file));
diff --git a/chrome/browser/chrome_plugin_host.cc b/chrome/browser/chrome_plugin_host.cc
index 373bee1..4548a48 100644
--- a/chrome/browser/chrome_plugin_host.cc
+++ b/chrome/browser/chrome_plugin_host.cc
@@ -8,6 +8,7 @@
#include "base/basictypes.h"
#include "base/command_line.h"
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/gfx/png_encoder.h"
#include "base/histogram.h"
@@ -637,8 +638,8 @@ CPError STDCALL CPR_AppendFileToUpload(CPRequest* request, const char* filepath,
CHECK(handler);
if (!length) length = kuint64max;
- std::wstring wfilepath(UTF8ToWide(filepath));
- handler->request()->AppendFileRangeToUpload(wfilepath, offset, length);
+ FilePath path(FilePath::FromWStringHack(UTF8ToWide(filepath)));
+ handler->request()->AppendFileRangeToUpload(path, offset, length);
return CPERR_SUCCESS;
}
diff --git a/chrome/browser/crash_recovery_uitest.cc b/chrome/browser/crash_recovery_uitest.cc
index 2ee7a98..bbd577a 100644
--- a/chrome/browser/crash_recovery_uitest.cc
+++ b/chrome/browser/crash_recovery_uitest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/file_path.h"
#include "base/file_util.h"
#include "chrome/test/automation/browser_proxy.h"
#include "chrome/test/automation/tab_proxy.h"
@@ -50,8 +51,8 @@ TEST_F(CrashRecoveryUITest, LoadInNewTab) {
return;
// The title of the active tab should change each time this URL is loaded.
- std::wstring test_file = test_data_directory_;
- file_util::AppendToPath(&test_file, L"title2.html");
+ FilePath test_file(FilePath::FromWStringHack(test_data_directory_));
+ test_file = test_file.AppendASCII("title2.html");
GURL url(net::FilePathToFileURL(test_file));
NavigateToURL(url);
diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h
index 37906d3..c013f0c 100644
--- a/chrome/browser/download/download_manager.h
+++ b/chrome/browser/download/download_manager.h
@@ -410,7 +410,6 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>,
bool HasAutoOpenFileTypesRegistered() const;
// Overridden from SelectFileDialog::Listener:
- // TODO(port): convert this to FilePath when SelectFileDialog gets converted.
virtual void FileSelected(const FilePath& path, int index, void* params);
virtual void FileSelectionCanceled(void* params);
diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc
index b54f060..23bb704 100644
--- a/chrome/browser/download/save_package.cc
+++ b/chrome/browser/download/save_package.cc
@@ -1041,7 +1041,7 @@ void SavePackage::GetSaveInfo() {
} else
#endif // defined(OS_LINUX) || defined(OS_WIN)
{
- // Just use 'suggested_name' instead of opening the dialog prompt.
+ // Just use 'suggested_path' instead of opening the dialog prompt.
ContinueSave(save_params, suggested_path, filter_index);
delete save_params;
}
diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc
index 03b54b9..723b1f3 100644
--- a/chrome/browser/extensions/user_script_master.cc
+++ b/chrome/browser/extensions/user_script_master.cc
@@ -155,7 +155,7 @@ void UserScriptMaster::ScriptReloader::LoadScriptsFromDirectory(
UserScript& user_script = result->back();
// Push single js file in this UserScript.
GURL url(std::string(chrome::kUserScriptScheme) + ":/" +
- net::FilePathToFileURL(file.ToWStringHack()).ExtractFileName());
+ net::FilePathToFileURL(file).ExtractFileName());
user_script.js_scripts().push_back(UserScript::File(file, url));
UserScript::File& script_file = user_script.js_scripts().back();
LoadScriptContent(&script_file);
diff --git a/chrome/browser/history/redirect_uitest.cc b/chrome/browser/history/redirect_uitest.cc
index af80496..1d27804 100644
--- a/chrome/browser/history/redirect_uitest.cc
+++ b/chrome/browser/history/redirect_uitest.cc
@@ -7,6 +7,7 @@
// here might indicate that WebKit changed the calls our glue layer gets in
// the case of redirects. It may also mean problems with the history system.
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/platform_thread.h"
#include "base/scoped_ptr.h"
@@ -81,8 +82,8 @@ TEST_F(RedirectTest, ClientEmptyReferer) {
ASSERT_TRUE(NULL != server.get());
GURL final_url = server->TestServerPageW(std::wstring());
- std::wstring test_file = test_data_directory_;
- file_util::AppendToPath(&test_file, L"file_client_redirect.html");
+ FilePath test_file(FilePath::FromWStringHack(test_data_directory_));
+ test_file = test_file.AppendASCII("file_client_redirect.html");
GURL first_url = net::FilePathToFileURL(test_file);
NavigateToURL(first_url);
@@ -107,8 +108,8 @@ TEST_F(RedirectTest, ClientEmptyReferer) {
// Tests to make sure a location change when a pending redirect exists isn't
// flagged as a redirect.
TEST_F(RedirectTest, ClientCancelled) {
- std::wstring first_path = test_data_directory_;
- file_util::AppendToPath(&first_path, L"cancelled_redirect_test.html");
+ FilePath first_path(FilePath::FromWStringHack(test_data_directory_));
+ first_path = first_path.AppendASCII("cancelled_redirect_test.html");
ASSERT_TRUE(file_util::AbsolutePath(&first_path));
GURL first_url = net::FilePathToFileURL(first_path);
@@ -132,11 +133,12 @@ TEST_F(RedirectTest, ClientCancelled) {
// containing an anchor using FilePathToFileURL will escape the anchor as
// %23, but in current_url the anchor will be '#'.
std::string final_ref = "myanchor";
- std::wstring current_path;
+ FilePath current_path;
ASSERT_TRUE(net::FileURLToFilePath(current_url, &current_path));
ASSERT_TRUE(file_util::AbsolutePath(&current_path));
// Path should remain unchanged.
- EXPECT_EQ(StringToLowerASCII(first_path), StringToLowerASCII(current_path));
+ EXPECT_EQ(StringToLowerASCII(first_path.value()),
+ StringToLowerASCII(current_path.value()));
EXPECT_EQ(final_ref, current_url.ref());
}
@@ -202,8 +204,8 @@ TEST_F(RedirectTest, NoHttpToFile) {
scoped_refptr<HTTPTestServer> server =
HTTPTestServer::CreateServer(kDocRoot, NULL);
ASSERT_TRUE(NULL != server.get());
- std::wstring test_file = test_data_directory_;
- file_util::AppendToPath(&test_file, L"http_to_file.html");
+ FilePath test_file(FilePath::FromWStringHack(test_data_directory_));
+ test_file = test_file.AppendASCII("http_to_file.html");
GURL file_url = net::FilePathToFileURL(test_file);
GURL initial_url = server->TestServerPageW(
@@ -226,8 +228,8 @@ TEST_F(RedirectTest, ClientFragments) {
HTTPTestServer::CreateServer(kDocRoot, NULL);
ASSERT_TRUE(NULL != server.get());
- std::wstring test_file = test_data_directory_;
- file_util::AppendToPath(&test_file, L"ref_redirect.html");
+ FilePath test_file(FilePath::FromWStringHack(test_data_directory_));
+ test_file = test_file.AppendASCII("ref_redirect.html");
GURL first_url = net::FilePathToFileURL(test_file);
std::vector<GURL> redirects;
diff --git a/chrome/browser/iframe_uitest.cc b/chrome/browser/iframe_uitest.cc
index 7e2e617..2f3a7f7 100644
--- a/chrome/browser/iframe_uitest.cc
+++ b/chrome/browser/iframe_uitest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/basictypes.h"
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/platform_thread.h"
#include "chrome/test/ui/ui_test.h"
@@ -10,9 +11,9 @@
class IFrameTest : public UITest {
protected:
- void NavigateAndVerifyTitle(const wchar_t* url, const wchar_t* page_title) {
- std::wstring test_file = test_data_directory_;
- file_util::AppendToPath(&test_file, url);
+ void NavigateAndVerifyTitle(const char* url, const wchar_t* page_title) {
+ FilePath test_file(FilePath::FromWStringHack(test_data_directory_));
+ test_file = test_file.AppendASCII(url);
NavigateToURL(net::FilePathToFileURL(test_file));
// The browser lazily updates the title.
@@ -27,9 +28,9 @@ class IFrameTest : public UITest {
};
TEST_F(IFrameTest, Crash) {
- NavigateAndVerifyTitle(L"iframe.html", L"iframe test");
+ NavigateAndVerifyTitle("iframe.html", L"iframe test");
}
TEST_F(IFrameTest, InEmptyFrame) {
- NavigateAndVerifyTitle(L"iframe_in_empty_frame.html", L"iframe test");
+ NavigateAndVerifyTitle("iframe_in_empty_frame.html", L"iframe test");
}
diff --git a/chrome/browser/metrics/metrics_service_uitest.cc b/chrome/browser/metrics/metrics_service_uitest.cc
index 9e6940ed..a994767 100644
--- a/chrome/browser/metrics/metrics_service_uitest.cc
+++ b/chrome/browser/metrics/metrics_service_uitest.cc
@@ -7,6 +7,7 @@
#include <string>
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/path_service.h"
#include "base/platform_thread.h"
@@ -33,14 +34,14 @@ class MetricsServiceTest : public UITest {
window_ = automation()->GetBrowserWindow(0);
ASSERT_TRUE(window_);
- std::wstring page1_path;
+ FilePath page1_path;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &page1_path));
- file_util::AppendToPath(&page1_path, L"title2.html");
+ page1_path = page1_path.AppendASCII("title2.html");
ASSERT_TRUE(window_->AppendTab(net::FilePathToFileURL(page1_path)));
- std::wstring page2_path;
+ FilePath page2_path;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &page2_path));
- file_util::AppendToPath(&page2_path, L"iframe.html");
+ page2_path = page2_path.AppendASCII("iframe.html");
ASSERT_TRUE(window_->AppendTab(net::FilePathToFileURL(page2_path)));
}
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index 0f80652..e049523 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -398,8 +398,9 @@ void RenderViewHost::DragTargetDragEnter(const WebDropData& drop_data,
for (std::vector<std::wstring>::const_iterator
iter(drop_data.filenames.begin());
iter != drop_data.filenames.end(); ++iter) {
- policy->GrantRequestURL(process()->pid(), net::FilePathToFileURL(*iter));
- policy->GrantUploadFile(process()->pid(), FilePath::FromWStringHack(*iter));
+ FilePath path = FilePath::FromWStringHack(*iter);
+ policy->GrantRequestURL(process()->pid(), net::FilePathToFileURL(path));
+ policy->GrantUploadFile(process()->pid(), path);
}
Send(new ViewMsg_DragTargetDragEnter(routing_id(), drop_data, client_pt,
screen_pt));
diff --git a/chrome/browser/renderer_host/renderer_security_policy.h b/chrome/browser/renderer_host/renderer_security_policy.h
index 2064700..84fd32c 100644
--- a/chrome/browser/renderer_host/renderer_security_policy.h
+++ b/chrome/browser/renderer_host/renderer_security_policy.h
@@ -10,6 +10,7 @@
#include <set>
#include "base/basictypes.h"
+#include "base/file_path.h"
#include "base/lock.h"
#include "base/singleton.h"
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc
index b2b2c73..1a73ca5 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc
@@ -122,9 +122,9 @@ bool ShouldServiceRequest(ChildProcessInfo::ProcessType process_type,
std::vector<net::UploadData::Element>::const_iterator iter;
for (iter = uploads.begin(); iter != uploads.end(); ++iter) {
if (iter->type() == net::UploadData::TYPE_FILE &&
- !policy->CanUploadFile(process_id,
- FilePath::FromWStringHack(iter->file_path()))) {
- NOTREACHED() << "Denied unauthorized upload of " << iter->file_path();
+ !policy->CanUploadFile(process_id, iter->file_path())) {
+ NOTREACHED() << "Denied unauthorized upload of "
+ << iter->file_path().value();
return false;
}
}
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc
index d44080f..682336a 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc
@@ -231,8 +231,8 @@ TEST_F(ResourceDispatcherTest, CrossSiteNavigationNonBuffered) {
// Now load a file:// page, which does not use the BufferedEventHandler.
// Make sure that the page loads and displays a title, and doesn't get stuck.
- std::wstring test_file = test_data_directory_;
- file_util::AppendToPath(&test_file, L"title2.html");
+ FilePath test_file(FilePath::FromWStringHack(test_data_directory_));
+ test_file = test_file.AppendASCII("title2.html");
bool timed_out = false;
tab->NavigateToURLWithTimeout(net::FilePathToFileURL(test_file),
action_max_timeout_ms(),
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc
index 7c389d5..bfd2d2c 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc
@@ -4,6 +4,7 @@
#include <vector>
+#include "base/file_path.h"
#include "base/message_loop.h"
#include "base/process_util.h"
#include "chrome/browser/renderer_host/renderer_security_policy.h"
@@ -532,7 +533,7 @@ TEST_F(ResourceDispatcherHostTest, CalculateApproximateMemoryCost) {
EXPECT_EQ(4434, ResourceDispatcherHost::CalculateApproximateMemoryCost(&req));
// Add a file upload -- should have no effect.
- req.AppendFileToUpload(L"does-not-exist.png");
+ req.AppendFileToUpload(FilePath(FILE_PATH_LITERAL("does-not-exist.png")));
EXPECT_EQ(4434, ResourceDispatcherHost::CalculateApproximateMemoryCost(&req));
}
diff --git a/chrome/browser/tab_restore_uitest.cc b/chrome/browser/tab_restore_uitest.cc
index 34922e6..b72e6dc 100644
--- a/chrome/browser/tab_restore_uitest.cc
+++ b/chrome/browser/tab_restore_uitest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/command_line.h"
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/win_util.h"
#include "chrome/app/chrome_dll_resource.h"
@@ -19,11 +20,10 @@
class TabRestoreUITest : public UITest {
public:
TabRestoreUITest() : UITest() {
- std::wstring path_prefix = test_data_directory_;
- file_util::AppendToPath(&path_prefix, L"session_history");
- path_prefix += FilePath::kSeparators[0];
- url1_ = net::FilePathToFileURL(path_prefix + L"bot1.html");
- url2_ = net::FilePathToFileURL(path_prefix + L"bot2.html");
+ FilePath path_prefix(FilePath::FromWStringHack(test_data_directory_));
+ path_prefix = path_prefix.AppendASCII("session_history");
+ url1_ = net::FilePathToFileURL(path_prefix.AppendASCII("bot1.html"));
+ url2_ = net::FilePathToFileURL(path_prefix.AppendASCII("bot2.html"));
}
protected:
diff --git a/chrome/browser/views/constrained_window_impl_interactive_uitest.cc b/chrome/browser/views/constrained_window_impl_interactive_uitest.cc
index a114168..1ccb80f 100644
--- a/chrome/browser/views/constrained_window_impl_interactive_uitest.cc
+++ b/chrome/browser/views/constrained_window_impl_interactive_uitest.cc
@@ -4,6 +4,7 @@
#include <string>
+#include "base/file_path.h"
#include "base/file_util.h"
#include "chrome/browser/view_ids.h"
#include "chrome/common/chrome_constants.h"
@@ -38,9 +39,9 @@ class InteractiveConstrainedWindowTest : public UITest {
}
void NavigateMainTabTo(const std::wstring& file_name) {
- std::wstring filename(test_data_directory_);
- file_util::AppendToPath(&filename, L"constrained_files");
- file_util::AppendToPath(&filename, file_name);
+ FilePath filename(FilePath::FromWStringHack(test_data_directory_));
+ filename = filename.AppendASCII("constrained_files");
+ filename = filename.Append(FilePath::FromWStringHack(file_name));
ASSERT_TRUE(tab_->NavigateToURL(net::FilePathToFileURL(filename)));
}
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 1c983d0..0d5404a 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -1105,7 +1105,7 @@ struct ParamTraits<net::UploadData::Element> {
r->SetToBytes(data, len);
} else {
DCHECK(type == net::UploadData::TYPE_FILE);
- std::wstring file_path;
+ FilePath file_path;
uint64 offset, length;
if (!ReadParam(m, iter, &file_path))
return false;
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 4b36a35..a39dca8 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -12,6 +12,7 @@
#include "build/build_config.h"
#include "base/clipboard.h"
+#include "base/file_path.h"
#include "base/gfx/rect.h"
#include "base/gfx/native_widget_types.h"
#include "base/shared_memory.h"
diff --git a/chrome/common/resource_dispatcher.cc b/chrome/common/resource_dispatcher.cc
index 08ace17..c507510 100644
--- a/chrome/common/resource_dispatcher.cc
+++ b/chrome/common/resource_dispatcher.cc
@@ -8,6 +8,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/file_path.h"
#include "base/message_loop.h"
#include "base/shared_memory.h"
#include "base/string_util.h"
@@ -60,7 +61,7 @@ class IPCResourceLoaderBridge : public ResourceLoaderBridge {
// ResourceLoaderBridge
virtual void AppendDataToUpload(const char* data, int data_len);
- virtual void AppendFileRangeToUpload(const std::wstring& path,
+ virtual void AppendFileRangeToUpload(const FilePath& path,
uint64 offset, uint64 length);
virtual void SetUploadIdentifier(int64 identifier);
virtual bool Start(Peer* peer);
@@ -157,7 +158,7 @@ void IPCResourceLoaderBridge::AppendDataToUpload(const char* data,
}
void IPCResourceLoaderBridge::AppendFileRangeToUpload(
- const std::wstring& path, uint64 offset, uint64 length) {
+ const FilePath& path, uint64 offset, uint64 length) {
DCHECK(request_id_ == -1) << "request already started";
if (!request_.upload_data)
diff --git a/chrome/plugin/chrome_plugin_host.cc b/chrome/plugin/chrome_plugin_host.cc
index adf1860..0f0e240 100644
--- a/chrome/plugin/chrome_plugin_host.cc
+++ b/chrome/plugin/chrome_plugin_host.cc
@@ -5,6 +5,7 @@
#include "chrome/plugin/chrome_plugin_host.h"
#include "base/command_line.h"
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/message_loop.h"
#include "chrome/common/child_process.h"
@@ -127,11 +128,11 @@ class PluginRequestHandlerProxy
upload_content_.back().SetToBytes(bytes, bytes_len);
}
- void AppendFileToUpload(const std::wstring &filepath) {
+ void AppendFileToUpload(const FilePath &filepath) {
AppendFileRangeToUpload(filepath, 0, kuint64max);
}
- void AppendFileRangeToUpload(const std::wstring &filepath,
+ void AppendFileRangeToUpload(const FilePath &filepath,
uint64 offset, uint64 length) {
upload_content_.push_back(net::UploadData::Element());
upload_content_.back().SetToFilePathRange(filepath, offset, length);
@@ -475,7 +476,8 @@ CPError STDCALL CPR_AppendFileToUpload(CPRequest* request, const char* filepath,
if (!length) length = kuint64max;
std::wstring wfilepath(UTF8ToWide(filepath));
- handler->AppendFileRangeToUpload(wfilepath, offset, length);
+ handler->AppendFileRangeToUpload(FilePath::FromWStringHack(wfilepath), offset,
+ length);
return CPERR_SUCCESS;
}
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 7f19567..3fe9dbb 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -9,6 +9,7 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/file_path.h"
#include "base/gfx/point.h"
#include "base/gfx/rect.h"
#include "base/id_map.h"
diff --git a/chrome/test/accessibility/accessibility_tests.cc b/chrome/test/accessibility/accessibility_tests.cc
index bc42dbc..542ba7f 100644
--- a/chrome/test/accessibility/accessibility_tests.cc
+++ b/chrome/test/accessibility/accessibility_tests.cc
@@ -140,8 +140,8 @@ TEST_F(AccessibilityTest, DISABLED_TestBackBtnStatusOnNewTab) {
// Set URL and check button status.
scoped_ptr<TabProxy> tab1(window->GetTab(0));
ASSERT_TRUE(tab1.get());
- std::wstring test_file1 = test_data_directory_;
- file_util::AppendToPath(&test_file1, L"title1.html");
+ FilePath test_file1(FilePath::FromWStringHack(test_data_directory_));
+ test_file1 = test_file1.AppendASCII("title1.html");
tab1->NavigateToURL(net::FilePathToFileURL(test_file1));
Sleep(sleep_timeout_ms());
EXPECT_EQ(STATE_SYSTEM_HASPOPUP | STATE_SYSTEM_FOCUSABLE,
@@ -167,8 +167,8 @@ TEST_F(AccessibilityTest, DISABLED_TestBackBtnStatusOnNewTab) {
// Add new tab with URL and check status.
ASSERT_TRUE(window->GetTabCount(&tab_count));
- std::wstring test_file2 = test_data_directory_;
- file_util::AppendToPath(&test_file2, L"title1.html");
+ FilePath test_file2(FilePath::FromWStringHack(test_data_directory_));
+ test_file2 = test_file2.AppendASCII("title1.html");
ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(test_file2)));
ASSERT_TRUE(window->WaitForTabCountToBecome(tab_count + 1,
action_max_timeout_ms()));
@@ -242,8 +242,8 @@ TEST_F(AccessibilityTest, DISABLED_TestForwardBtnStatusOnNewTab) {
// Set URL and check button status.
scoped_ptr<TabProxy> tab1(window->GetTab(0));
ASSERT_TRUE(tab1.get());
- std::wstring test_file1 = test_data_directory_;
- file_util::AppendToPath(&test_file1, L"title1.html");
+ FilePath test_file1(FilePath::FromWStringHack(test_data_directory_));
+ test_file1 = test_file1.AppendASCII("title1.html");
tab1->NavigateToURL(net::FilePathToFileURL(test_file1));
Sleep(sleep_timeout_ms());
EXPECT_EQ(STATE_SYSTEM_HASPOPUP |
@@ -275,8 +275,8 @@ TEST_F(AccessibilityTest, DISABLED_TestForwardBtnStatusOnNewTab) {
// Add new tab with URL and check status.
ASSERT_TRUE(window->GetTabCount(&tab_count));
- std::wstring test_file2 = test_data_directory_;
- file_util::AppendToPath(&test_file2, L"title1.html");
+ FilePath test_file2(FilePath::FromWStringHack(test_data_directory_));
+ test_file2 = test_file2.AppendASCII("title1.html");
ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(test_file2)));
ASSERT_TRUE(window->WaitForTabCountToBecome(tab_count + 1,
action_max_timeout_ms()));
@@ -328,8 +328,8 @@ TEST_F(AccessibilityTest, DISABLED_TestStarBtnStatusOnNewTab) {
// Set URL and check button status.
scoped_ptr<TabProxy> tab1(window->GetTab(0));
ASSERT_TRUE(tab1.get());
- std::wstring test_file1 = test_data_directory_;
- file_util::AppendToPath(&test_file1, L"title1.html");
+ FilePath test_file1(FilePath::FromWStringHack(test_data_directory_));
+ test_file1 = test_file1.AppendASCII("title1.html");
tab1->NavigateToURL(net::FilePathToFileURL(test_file1));
Sleep(sleep_timeout_ms());
EXPECT_EQ(STATE_SYSTEM_FOCUSABLE, GetState(acc_obj));
@@ -346,8 +346,8 @@ TEST_F(AccessibilityTest, DISABLED_TestStarBtnStatusOnNewTab) {
// Add new tab with URL and check status.
ASSERT_TRUE(window->GetTabCount(&tab_count));
- std::wstring test_file2 = test_data_directory_;
- file_util::AppendToPath(&test_file2, L"title1.html");
+ FilePath test_file2(FilePath::FromWStringHack(test_data_directory_));
+ test_file2 = test_file2.AppendASCII("title1.html");
ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(test_file2)));
ASSERT_TRUE(window->WaitForTabCountToBecome(tab_count + 1,
action_max_timeout_ms()));
diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc
index d2d6ac7..464fa81 100644
--- a/chrome/test/automation/automation_proxy_uitest.cc
+++ b/chrome/test/automation/automation_proxy_uitest.cc
@@ -194,8 +194,8 @@ TEST_F(AutomationProxyVisibleTest, AppendTab) {
ASSERT_EQ(tab_count - 1, active_tab_index);
ASSERT_NE(original_active_tab_index, active_tab_index);
- std::wstring filename(test_data_directory_);
- file_util::AppendToPath(&filename, L"title2.html");
+ FilePath filename(FilePath::FromWStringHack(test_data_directory_));
+ filename = filename.AppendASCII("title2.html");
ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(filename)));
int appended_tab_index;
@@ -262,8 +262,8 @@ TEST_F(AutomationProxyTest, NavigateToURL) {
// BUG [634097] : expected title should be "about:blank"
ASSERT_STREQ(L"", title.c_str());
- std::wstring filename(test_data_directory_);
- file_util::AppendToPath(&filename, L"title2.html");
+ FilePath filename(FilePath::FromWStringHack(test_data_directory_));
+ filename = filename.AppendASCII("title2.html");
tab->NavigateToURL(net::FilePathToFileURL(filename));
ASSERT_TRUE(tab->GetTabTitle(&title));
@@ -279,8 +279,8 @@ TEST_F(AutomationProxyTest, DISABLED_NavigateToURLWithTimeout1) {
scoped_ptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
- std::wstring filename(test_data_directory_);
- file_util::AppendToPath(&filename, L"title2.html");
+ FilePath filename(FilePath::FromWStringHack(test_data_directory_));
+ filename = filename.AppendASCII("title2.html");
bool is_timeout;
tab->NavigateToURLWithTimeout(net::FilePathToFileURL(filename),
@@ -306,16 +306,16 @@ TEST_F(AutomationProxyTest, DISABLED_NavigateToURLWithTimeout2) {
tab.reset(window->GetTab(0));
ASSERT_TRUE(tab.get());
- std::wstring filename1(test_data_directory_);
- file_util::AppendToPath(&filename1, L"title1.html");
+ FilePath filename1(FilePath::FromWStringHack(test_data_directory_));
+ filename1 = filename1.AppendASCII("title1.html");
bool is_timeout;
tab->NavigateToURLWithTimeout(net::FilePathToFileURL(filename1),
1, &is_timeout);
ASSERT_TRUE(is_timeout);
- std::wstring filename2(test_data_directory_);
- file_util::AppendToPath(&filename2, L"title2.html");
+ FilePath filename2(FilePath::FromWStringHack(test_data_directory_));
+ filename2 = filename2.AppendASCII("title1.html");
tab->NavigateToURLWithTimeout(net::FilePathToFileURL(filename2),
10000, &is_timeout);
ASSERT_FALSE(is_timeout);
@@ -338,8 +338,8 @@ TEST_F(AutomationProxyTest, GoBackForward) {
ASSERT_TRUE(tab->GetTabTitle(&title));
ASSERT_STREQ(L"", title.c_str());
- std::wstring filename(test_data_directory_);
- file_util::AppendToPath(&filename, L"title2.html");
+ FilePath filename(FilePath::FromWStringHack(test_data_directory_));
+ filename = filename.AppendASCII("title2.html");
ASSERT_TRUE(tab->NavigateToURL(net::FilePathToFileURL(filename)));
ASSERT_TRUE(tab->GetTabTitle(&title));
ASSERT_STREQ(L"Title Of Awesomeness", title.c_str());
@@ -367,8 +367,8 @@ TEST_F(AutomationProxyTest, GetCurrentURL) {
ASSERT_TRUE(tab->GetCurrentURL(&url));
ASSERT_STREQ("about:blank", url.spec().c_str());
- std::wstring filename(test_data_directory_);
- file_util::AppendToPath(&filename, L"cookie1.html");
+ FilePath filename(FilePath::FromWStringHack(test_data_directory_));
+ filename = filename.AppendASCII("cookie1.html");
GURL newurl = net::FilePathToFileURL(filename);
ASSERT_TRUE(tab->NavigateToURL(newurl));
ASSERT_TRUE(tab->GetCurrentURL(&url));
@@ -474,8 +474,8 @@ TEST_F(AutomationProxyTest, NavigateToURLAsync) {
scoped_ptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
- std::wstring filename(test_data_directory_);
- file_util::AppendToPath(&filename, L"cookie1.html");
+ FilePath filename(FilePath::FromWStringHack(test_data_directory_));
+ filename = filename.AppendASCII("cookie1.html");
GURL newurl = net::FilePathToFileURL(filename);
ASSERT_TRUE(tab->NavigateToURLAsync(newurl));
@@ -657,9 +657,9 @@ TEST_F(AutomationProxyTest, DISABLED_ConstrainedWindowTest) {
tab.reset(window->GetTab(0));
ASSERT_TRUE(tab.get());
- std::wstring filename(test_data_directory_);
- file_util::AppendToPath(&filename, L"constrained_files");
- file_util::AppendToPath(&filename, L"constrained_window.html");
+ FilePath filename(FilePath::FromWStringHack(test_data_directory_));
+ filename = filename.AppendASCII("constrained_files");
+ filename = filename.AppendASCII("constrained_window.html");
ASSERT_TRUE(tab->NavigateToURL(net::FilePathToFileURL(filename)));
@@ -698,9 +698,9 @@ TEST_F(AutomationProxyTest, CantEscapeByOnloadMoveto) {
tab.reset(window->GetTab(0));
ASSERT_TRUE(tab.get());
- std::wstring filename(test_data_directory_);
- file_util::AppendToPath(&filename, L"constrained_files");
- file_util::AppendToPath(&filename, L"constrained_window_onload_moveto.html");
+ FilePath filename(FilePath::FromWStringHack(test_data_directory_));
+ filename = filename.AppendASCII("constrained_files");
+ filename = filename.AppendASCII("constrained_window_onload_moveto.html");
ASSERT_TRUE(tab->NavigateToURL(net::FilePathToFileURL(filename)));
@@ -1101,8 +1101,8 @@ TEST_F(AutomationProxyTest5, TestLifetimeOfDomAutomationController) {
scoped_ptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
- std::wstring filename(test_data_directory_);
- file_util::AppendToPath(&filename, L"dom_automation_test_with_popup.html");
+ FilePath filename(FilePath::FromWStringHack(test_data_directory_));
+ filename = filename.AppendASCII("dom_automation_test_with_popup.html");
tab->NavigateToURL(net::FilePathToFileURL(filename));
diff --git a/chrome/test/plugin/plugin_test.cpp b/chrome/test/plugin/plugin_test.cpp
index 4907a9a..77bc77d 100644
--- a/chrome/test/plugin/plugin_test.cpp
+++ b/chrome/test/plugin/plugin_test.cpp
@@ -47,6 +47,7 @@
#include <string.h>
#include <memory.h>
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/registry.h"
#include "chrome/common/chrome_switches.h"
@@ -102,10 +103,10 @@ class PluginTest : public UITest {
// Generate the URL for testing a particular test.
// HTML for the tests is all located in test_directory\plugin\<testcase>
GURL GetTestUrl(const std::wstring &test_case) {
- std::wstring path;
+ FilePath path;
PathService::Get(chrome::DIR_TEST_DATA, &path);
- file_util::AppendToPath(&path, L"plugin");
- file_util::AppendToPath(&path, test_case);
+ path = path.AppendASCII("plugin");
+ path = path.Append(FilePath::FromWStringHack(test_case));
return net::FilePathToFileURL(path);
}
diff --git a/chrome/test/selenium/selenium_test.cc b/chrome/test/selenium/selenium_test.cc
index be66b0d..590d996 100644
--- a/chrome/test/selenium/selenium_test.cc
+++ b/chrome/test/selenium/selenium_test.cc
@@ -12,6 +12,7 @@
#include <list>
#include <set>
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/path_service.h"
#include "base/rand_util.h"
@@ -101,7 +102,7 @@ class SeleniumTest : public UITest {
file_util::AppendToPath(&test_path, L"core");
file_util::AppendToPath(&test_path, L"TestRunner.html");
- GURL test_url(net::FilePathToFileURL(test_path));
+ GURL test_url(net::FilePathToFileURL(FilePath::FromWStringHack(test_path)));
scoped_ptr<TabProxy> tab(GetActiveTab());
tab->NavigateToURL(test_url);
diff --git a/chrome/test/tab_switching/tab_switching_test.cc b/chrome/test/tab_switching/tab_switching_test.cc
index 3cbbfa6..d56be38 100644
--- a/chrome/test/tab_switching/tab_switching_test.cc
+++ b/chrome/test/tab_switching/tab_switching_test.cc
@@ -108,18 +108,17 @@ class TabSwitchingUITest : public UITest {
// Opens new tabs. Returns the number of tabs opened.
int OpenTabs() {
// Add tabs.
- static const wchar_t* files[] = { L"espn.go.com", L"bugzilla.mozilla.org",
- L"news.cnet.com", L"www.amazon.com",
- L"kannada.chakradeo.net", L"allegro.pl",
- L"ml.wikipedia.org", L"www.bbc.co.uk",
- L"126.com", L"www.altavista.com"};
+ static const char* files[] = { "espn.go.com", "bugzilla.mozilla.org",
+ "news.cnet.com", "www.amazon.com",
+ "kannada.chakradeo.net", "allegro.pl",
+ "ml.wikipedia.org", "www.bbc.co.uk",
+ "126.com", "www.altavista.com"};
int number_of_new_tabs_opened = 0;
- std::wstring file_name;
+ FilePath file_name;
for (int i = 0; i < arraysize(files); ++i) {
- file_name = path_prefix_;
- file_name += files[i];
- file_name += FilePath::kSeparators[0];
- file_name += L"index.html";
+ file_name = FilePath::FromWStringHack(path_prefix_);
+ file_name = file_name.AppendASCII(files[i]);
+ file_name = file_name.AppendASCII("index.html");
browser_proxy_->AppendTab(net::FilePathToFileURL(file_name));
number_of_new_tabs_opened++;
}
diff --git a/chrome/test/ui/layout_plugin_uitest.cc b/chrome/test/ui/layout_plugin_uitest.cc
index fa46e2a..f0778ab 100644
--- a/chrome/test/ui/layout_plugin_uitest.cc
+++ b/chrome/test/ui/layout_plugin_uitest.cc
@@ -57,9 +57,9 @@ TEST_F(LayoutPluginTester, UnloadNoCrash) {
CreateDirectory(plugins_directory.c_str(), NULL);
CopyFile(plugin_src.c_str(), plugin_dest.c_str(), true /* overwrite */);
- std::wstring path;
+ FilePath path;
PathService::Get(chrome::DIR_TEST_DATA, &path);
- file_util::AppendToPath(&path, L"npapi/layout_test_plugin.html");
+ path = path.AppendASCII("npapi").AppendASCII("layout_test_plugin.html");
NavigateToURL(net::FilePathToFileURL(path));
std::wstring title;
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index 6b43ae0..5cd8e2a 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -774,7 +774,7 @@ GURL UITest::GetTestUrl(const std::wstring& test_directory,
PathService::Get(chrome::DIR_TEST_DATA, &path);
file_util::AppendToPath(&path, test_directory);
file_util::AppendToPath(&path, test_case);
- return net::FilePathToFileURL(path);
+ return net::FilePathToFileURL(FilePath::FromWStringHack(path));
}
void UITest::WaitForFinish(const std::string &name,
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index 7865b4e..9610e40 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -673,10 +673,6 @@ GURL FilePathToFileURL(const FilePath& path) {
return GURL(url_string);
}
-GURL FilePathToFileURL(const std::wstring& path_str) {
- return FilePathToFileURL(FilePath::FromWStringHack(path_str));
-}
-
std::wstring GetSpecificHeader(const std::wstring& headers,
const std::wstring& name) {
return GetSpecificHeaderT(headers, name);
@@ -945,14 +941,6 @@ int SetNonBlocking(int fd) {
#endif
}
-// Deprecated.
-bool FileURLToFilePath(const GURL& gurl, std::wstring* file_path) {
- FilePath path;
- bool rv = FileURLToFilePath(gurl, &path);
- *file_path = path.ToWStringHack();
- return rv;
-}
-
bool GetHostAndPort(std::string::const_iterator host_and_port_begin,
std::string::const_iterator host_and_port_end,
std::string* host,
diff --git a/net/base/net_util.h b/net/base/net_util.h
index 3305f49..2ad81bf 100644
--- a/net/base/net_util.h
+++ b/net/base/net_util.h
@@ -28,16 +28,12 @@ namespace net {
// Given the full path to a file name, creates a file: URL. The returned URL
// may not be valid if the input is malformed.
GURL FilePathToFileURL(const FilePath& path);
-// Deprecated temporary compatibility function.
-GURL FilePathToFileURL(const std::wstring& file_path);
// Converts a file: URL back to a filename that can be passed to the OS. The
// file URL must be well-formed (GURL::is_valid() must return true); we don't
// handle degenerate cases here. Returns true on success, false if it isn't a
// valid file URL. On failure, *file_path will be empty.
bool FileURLToFilePath(const GURL& url, FilePath* file_path);
-// Deprecated temporary compatibility function.
-bool FileURLToFilePath(const GURL& url, std::wstring* file_path);
// Split an input of the form <host>[":"<port>] into its consitituent parts.
// Saves the result into |*host| and |*port|. If the input did not have
diff --git a/net/base/net_util_unittest.cc b/net/base/net_util_unittest.cc
index 423c62c..f9bc7f7 100644
--- a/net/base/net_util_unittest.cc
+++ b/net/base/net_util_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/basictypes.h"
+#include "base/file_path.h"
#include "base/string_util.h"
#include "base/time.h"
#include "googleurl/src/gurl.h"
@@ -22,7 +23,7 @@ class NetUtilTest : public testing::Test {
struct FileCase {
const wchar_t* file;
- const wchar_t* url;
+ const char* url;
};
struct HeaderCase {
@@ -114,76 +115,76 @@ TEST(NetUtilTest, FileURLConversion) {
// a list of test file names and the corresponding URLs
const FileCase round_trip_cases[] = {
#if defined(OS_WIN)
- {L"C:\\foo\\bar.txt", L"file:///C:/foo/bar.txt"},
+ {L"C:\\foo\\bar.txt", "file:///C:/foo/bar.txt"},
{L"\\\\some computer\\foo\\bar.txt",
- L"file://some%20computer/foo/bar.txt"}, // UNC
+ "file://some%20computer/foo/bar.txt"}, // UNC
{L"D:\\Name;with%some symbols*#",
- L"file:///D:/Name%3Bwith%25some%20symbols*%23"},
+ "file:///D:/Name%3Bwith%25some%20symbols*%23"},
{L"D:\\Chinese\\\x6240\x6709\x4e2d\x6587\x7f51\x9875.doc",
- L"file:///D:/Chinese/%E6%89%80%E6%9C%89%E4%B8%AD%E6%96%87%E7%BD%91"
- L"%E9%A1%B5.doc"},
+ "file:///D:/Chinese/%E6%89%80%E6%9C%89%E4%B8%AD%E6%96%87%E7%BD%91"
+ "%E9%A1%B5.doc"},
#elif defined(OS_POSIX)
- {L"/foo/bar.txt", L"file:///foo/bar.txt"},
- {L"/foo/BAR.txt", L"file:///foo/BAR.txt"},
- {L"/C:/foo/bar.txt", L"file:///C:/foo/bar.txt"},
- {L"/some computer/foo/bar.txt", L"file:///some%20computer/foo/bar.txt"},
- {L"/Name;with%some symbols*#", L"file:///Name%3Bwith%25some%20symbols*%23"},
+ {L"/foo/bar.txt", "file:///foo/bar.txt"},
+ {L"/foo/BAR.txt", "file:///foo/BAR.txt"},
+ {L"/C:/foo/bar.txt", "file:///C:/foo/bar.txt"},
+ {L"/some computer/foo/bar.txt", "file:///some%20computer/foo/bar.txt"},
+ {L"/Name;with%some symbols*#", "file:///Name%3Bwith%25some%20symbols*%23"},
{L"/Chinese/\x6240\x6709\x4e2d\x6587\x7f51\x9875.doc",
- L"file:///Chinese/%E6%89%80%E6%9C%89%E4%B8%AD%E6%96%87%E7%BD"
- L"%91%E9%A1%B5.doc"},
+ "file:///Chinese/%E6%89%80%E6%9C%89%E4%B8%AD%E6%96%87%E7%BD"
+ "%91%E9%A1%B5.doc"},
#endif
};
// First, we'll test that we can round-trip all of the above cases of URLs
- std::wstring output;
+ FilePath output;
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(round_trip_cases); i++) {
// convert to the file URL
- GURL file_url(net::FilePathToFileURL(round_trip_cases[i].file));
- EXPECT_EQ(std::wstring(round_trip_cases[i].url),
- UTF8ToWide(file_url.spec()));
+ GURL file_url(net::FilePathToFileURL(
+ FilePath::FromWStringHack(round_trip_cases[i].file)));
+ EXPECT_EQ(round_trip_cases[i].url, file_url.spec());
// Back to the filename.
EXPECT_TRUE(net::FileURLToFilePath(file_url, &output));
- EXPECT_EQ(std::wstring(round_trip_cases[i].file), output);
+ EXPECT_EQ(round_trip_cases[i].file, output.ToWStringHack());
}
// Test that various file: URLs get decoded into the correct file type
FileCase url_cases[] = {
#if defined(OS_WIN)
- {L"C:\\foo\\bar.txt", L"file:c|/foo\\bar.txt"},
- {L"C:\\foo\\bar.txt", L"file:/c:/foo/bar.txt"},
- {L"\\\\foo\\bar.txt", L"file://foo\\bar.txt"},
- {L"C:\\foo\\bar.txt", L"file:///c:/foo/bar.txt"},
- {L"\\\\foo\\bar.txt", L"file:////foo\\bar.txt"},
- {L"\\\\foo\\bar.txt", L"file:/foo/bar.txt"},
- {L"\\\\foo\\bar.txt", L"file://foo\\bar.txt"},
- {L"C:\\foo\\bar.txt", L"file:\\\\\\c:/foo/bar.txt"},
+ {L"C:\\foo\\bar.txt", "file:c|/foo\\bar.txt"},
+ {L"C:\\foo\\bar.txt", "file:/c:/foo/bar.txt"},
+ {L"\\\\foo\\bar.txt", "file://foo\\bar.txt"},
+ {L"C:\\foo\\bar.txt", "file:///c:/foo/bar.txt"},
+ {L"\\\\foo\\bar.txt", "file:////foo\\bar.txt"},
+ {L"\\\\foo\\bar.txt", "file:/foo/bar.txt"},
+ {L"\\\\foo\\bar.txt", "file://foo\\bar.txt"},
+ {L"C:\\foo\\bar.txt", "file:\\\\\\c:/foo/bar.txt"},
#elif defined(OS_POSIX)
- {L"/c:/foo/bar.txt", L"file:/c:/foo/bar.txt"},
- {L"/c:/foo/bar.txt", L"file:///c:/foo/bar.txt"},
- {L"/foo/bar.txt", L"file:/foo/bar.txt"},
- {L"/c:/foo/bar.txt", L"file:\\\\\\c:/foo/bar.txt"},
- {L"/foo/bar.txt", L"file:foo/bar.txt"},
- {L"/bar.txt", L"file://foo/bar.txt"},
- {L"/foo/bar.txt", L"file:///foo/bar.txt"},
- {L"/foo/bar.txt", L"file:////foo/bar.txt"},
- {L"/foo/bar.txt", L"file:////foo//bar.txt"},
- {L"/foo/bar.txt", L"file:////foo///bar.txt"},
- {L"/foo/bar.txt", L"file:////foo////bar.txt"},
- {L"/c:/foo/bar.txt", L"file:\\\\\\c:/foo/bar.txt"},
- {L"/c:/foo/bar.txt", L"file:c:/foo/bar.txt"},
+ {L"/c:/foo/bar.txt", "file:/c:/foo/bar.txt"},
+ {L"/c:/foo/bar.txt", "file:///c:/foo/bar.txt"},
+ {L"/foo/bar.txt", "file:/foo/bar.txt"},
+ {L"/c:/foo/bar.txt", "file:\\\\\\c:/foo/bar.txt"},
+ {L"/foo/bar.txt", "file:foo/bar.txt"},
+ {L"/bar.txt", "file://foo/bar.txt"},
+ {L"/foo/bar.txt", "file:///foo/bar.txt"},
+ {L"/foo/bar.txt", "file:////foo/bar.txt"},
+ {L"/foo/bar.txt", "file:////foo//bar.txt"},
+ {L"/foo/bar.txt", "file:////foo///bar.txt"},
+ {L"/foo/bar.txt", "file:////foo////bar.txt"},
+ {L"/c:/foo/bar.txt", "file:\\\\\\c:/foo/bar.txt"},
+ {L"/c:/foo/bar.txt", "file:c:/foo/bar.txt"},
// We get these wrong because GURL turns back slashes into forward
// slashes.
- //{L"/foo%5Cbar.txt", L"file://foo\\bar.txt"},
- //{L"/c|/foo%5Cbar.txt", L"file:c|/foo\\bar.txt"},
- //{L"/foo%5Cbar.txt", L"file://foo\\bar.txt"},
- //{L"/foo%5Cbar.txt", L"file:////foo\\bar.txt"},
- //{L"/foo%5Cbar.txt", L"file://foo\\bar.txt"},
+ //{L"/foo%5Cbar.txt", "file://foo\\bar.txt"},
+ //{L"/c|/foo%5Cbar.txt", "file:c|/foo\\bar.txt"},
+ //{L"/foo%5Cbar.txt", "file://foo\\bar.txt"},
+ //{L"/foo%5Cbar.txt", "file:////foo\\bar.txt"},
+ //{L"/foo%5Cbar.txt", "file://foo\\bar.txt"},
#endif
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(url_cases); i++) {
- net::FileURLToFilePath(GURL(WideToUTF8(url_cases[i].url)), &output);
- EXPECT_EQ(std::wstring(url_cases[i].file), output);
+ net::FileURLToFilePath(GURL(url_cases[i].url), &output);
+ EXPECT_EQ(url_cases[i].file, output.ToWStringHack());
}
// Here, we test that UTF-8 encoded strings get decoded properly, even when
@@ -199,7 +200,7 @@ TEST(NetUtilTest, FileURLConversion) {
L"\x96\x87\xe7\xbd\x91\xe9\xa1\xb5.doc";
#endif
EXPECT_TRUE(net::FileURLToFilePath(GURL(WideToUTF8(utf8)), &output));
- EXPECT_EQ(std::wstring(wide), output);
+ EXPECT_EQ(wide, output.ToWStringHack());
// Unfortunately, UTF8ToWide discards invalid UTF8 input.
#ifdef BUG_878908_IS_FIXED
diff --git a/net/base/upload_data.h b/net/base/upload_data.h
index 231b40b..56a1339 100644
--- a/net/base/upload_data.h
+++ b/net/base/upload_data.h
@@ -8,6 +8,7 @@
#include <string>
#include <vector>
+#include "base/file_path.h"
#include "base/ref_counted.h"
namespace net {
@@ -29,7 +30,7 @@ class UploadData : public base::RefCounted<UploadData> {
Type type() const { return type_; }
const std::vector<char>& bytes() const { return bytes_; }
- const std::wstring& file_path() const { return file_path_; }
+ const FilePath& file_path() const { return file_path_; }
uint64 file_range_offset() const { return file_range_offset_; }
uint64 file_range_length() const { return file_range_length_; }
@@ -38,11 +39,11 @@ class UploadData : public base::RefCounted<UploadData> {
bytes_.assign(bytes, bytes + bytes_len);
}
- void SetToFilePath(const std::wstring& path) {
+ void SetToFilePath(const FilePath& path) {
SetToFilePathRange(path, 0, kuint64max);
}
- void SetToFilePathRange(const std::wstring& path,
+ void SetToFilePathRange(const FilePath& path,
uint64 offset, uint64 length) {
type_ = TYPE_FILE;
file_path_ = path;
@@ -57,7 +58,7 @@ class UploadData : public base::RefCounted<UploadData> {
private:
Type type_;
std::vector<char> bytes_;
- std::wstring file_path_;
+ FilePath file_path_;
uint64 file_range_offset_;
uint64 file_range_length_;
};
@@ -69,12 +70,12 @@ class UploadData : public base::RefCounted<UploadData> {
}
}
- void AppendFile(const std::wstring& file_path) {
+ void AppendFile(const FilePath& file_path) {
elements_.push_back(Element());
elements_.back().SetToFilePath(file_path);
}
- void AppendFileRange(const std::wstring& file_path,
+ void AppendFileRange(const FilePath& file_path,
uint64 offset, uint64 length) {
elements_.push_back(Element());
elements_.back().SetToFilePathRange(file_path, offset, length);
diff --git a/net/base/upload_data_stream.cc b/net/base/upload_data_stream.cc
index 1438e20..0a41a13 100644
--- a/net/base/upload_data_stream.cc
+++ b/net/base/upload_data_stream.cc
@@ -65,19 +65,19 @@ void UploadDataStream::FillBuf() {
if (!next_element_stream_.IsOpen()) {
int flags = base::PLATFORM_FILE_OPEN |
base::PLATFORM_FILE_READ;
- int rv = next_element_stream_.Open(
- FilePath::FromWStringHack(element.file_path()), flags);
+ int rv = next_element_stream_.Open(element.file_path(), flags);
// If the file does not exist, that's technically okay.. we'll just
// upload an empty file. This is for consistency with Mozilla.
- DLOG_IF(WARNING, rv != OK) << "Failed to open \"" <<
- element.file_path() << "\" for reading: " << rv;
+ DLOG_IF(WARNING, rv != OK) << "Failed to open \""
+ << element.file_path().value()
+ << "\" for reading: " << rv;
next_element_remaining_ = 0; // Default to reading nothing.
if (rv == OK) {
uint64 offset = element.file_range_offset();
if (offset && next_element_stream_.Seek(FROM_BEGIN, offset) < 0) {
- DLOG(WARNING) << "Failed to seek \"" << element.file_path() <<
- "\" to offset: " << offset;
+ DLOG(WARNING) << "Failed to seek \"" << element.file_path().value()
+ << "\" to offset: " << offset;
} else {
next_element_remaining_ = element.file_range_length();
}
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
index d6c34f1..acf70dd 100644
--- a/net/url_request/url_request.cc
+++ b/net/url_request/url_request.cc
@@ -94,9 +94,9 @@ void URLRequest::AppendBytesToUpload(const char* bytes, int bytes_len) {
upload_->AppendBytes(bytes, bytes_len);
}
-void URLRequest::AppendFileRangeToUpload(const wstring& file_path,
+void URLRequest::AppendFileRangeToUpload(const FilePath& file_path,
uint64 offset, uint64 length) {
- DCHECK(file_path.length() > 0 && length > 0);
+ DCHECK(file_path.value().length() > 0 && length > 0);
if (!upload_)
upload_ = new UploadData();
upload_->AppendFileRange(file_path, offset, length);
diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h
index d45e510..a075764 100644
--- a/net/url_request/url_request.h
+++ b/net/url_request/url_request.h
@@ -8,6 +8,7 @@
#include <string>
#include <vector>
+#include "base/file_path.h"
#include "base/logging.h"
#include "base/ref_counted.h"
#include "googleurl/src/gurl.h"
@@ -236,9 +237,9 @@ class URLRequest {
// When uploading a file range, length must be non-zero. If length
// exceeds the end-of-file, the upload is clipped at end-of-file.
void AppendBytesToUpload(const char* bytes, int bytes_len);
- void AppendFileRangeToUpload(const std::wstring& file_path,
+ void AppendFileRangeToUpload(const FilePath& file_path,
uint64 offset, uint64 length);
- void AppendFileToUpload(const std::wstring& file_path) {
+ void AppendFileToUpload(const FilePath& file_path) {
AppendFileRangeToUpload(file_path, 0, kuint64max);
}
diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc
index 097169f..db3ff13 100644
--- a/net/url_request/url_request_file_job.cc
+++ b/net/url_request/url_request_file_job.cc
@@ -238,7 +238,7 @@ bool URLRequestFileJob::IsRedirectResponse(
if (!resolved)
return false;
- *location = net::FilePathToFileURL(new_path);
+ *location = net::FilePathToFileURL(FilePath(new_path));
*http_status_code = 301;
return true;
#else
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index fbfaafe..372ff43 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -16,6 +16,7 @@
#include <algorithm>
#include <string>
+#include "base/file_path.h"
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/process_util.h"
@@ -526,16 +527,17 @@ TEST_F(URLRequestTest, PostFileTest) {
PathService::Get(base::DIR_EXE, &dir);
file_util::SetCurrentDirectory(dir);
- std::wstring path;
+ FilePath path;
PathService::Get(base::DIR_SOURCE_ROOT, &path);
- file_util::AppendToPath(&path, L"net");
- file_util::AppendToPath(&path, L"data");
- file_util::AppendToPath(&path, L"url_request_unittest");
- file_util::AppendToPath(&path, L"with-headers.html");
+ path = path.Append(FILE_PATH_LITERAL("net"));
+ path = path.Append(FILE_PATH_LITERAL("data"));
+ path = path.Append(FILE_PATH_LITERAL("url_request_unittest"));
+ path = path.Append(FILE_PATH_LITERAL("with-headers.html"));
r.AppendFileToUpload(path);
// This file should just be ignored in the upload stream.
- r.AppendFileToUpload(L"c:\\path\\to\\non\\existant\\file.randomness.12345");
+ r.AppendFileToUpload(FilePath(FILE_PATH_LITERAL(
+ "c:\\path\\to\\non\\existant\\file.randomness.12345")));
r.Start();
EXPECT_TRUE(r.is_pending());
@@ -586,7 +588,7 @@ TEST_F(URLRequestTest, AboutBlankTest) {
TEST_F(URLRequestTest, FileTest) {
FilePath app_path;
PathService::Get(base::FILE_EXE, &app_path);
- GURL app_url = net::FilePathToFileURL(app_path.ToWStringHack());
+ GURL app_url = net::FilePathToFileURL(app_path);
TestDelegate d;
{
@@ -760,7 +762,7 @@ TEST_F(URLRequestTest, ResolveShortcutTest) {
TestDelegate d;
{
- TestURLRequest r(net::FilePathToFileURL(lnk_path), &d);
+ TestURLRequest r(net::FilePathToFileURL(FilePath(lnk_path)), &d);
r.Start();
EXPECT_TRUE(r.is_pending());
@@ -823,11 +825,10 @@ TEST_F(URLRequestTest, FileDirCancelTest) {
TestDelegate d;
{
- std::wstring file_path;
+ FilePath file_path;
PathService::Get(base::DIR_SOURCE_ROOT, &file_path);
- file_util::AppendToPath(&file_path, L"net");
- file_util::AppendToPath(&file_path, L"data");
- file_util::AppendToPath(&file_path, L"");
+ file_path = file_path.Append(FILE_PATH_LITERAL("net"));
+ file_path = file_path.Append(FILE_PATH_LITERAL("data"));
TestURLRequest req(net::FilePathToFileURL(file_path), &d);
req.Start();
diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc
index 02e891d..bfa6db4 100644
--- a/webkit/glue/chrome_client_impl.cc
+++ b/webkit/glue/chrome_client_impl.cc
@@ -52,17 +52,17 @@ class WebFileChooserCallbackImpl : public WebFileChooserCallback {
: file_chooser_(file_chooser) {
}
- void OnFileChoose(const std::vector<std::wstring>& file_names) {
+ virtual void OnFileChoose(const std::vector<FilePath>& file_names) {
if (file_names.empty()) {
file_chooser_->chooseFile(WebCore::String(""));
} else if (file_names.size() == 1) {
file_chooser_->chooseFile(
- webkit_glue::StdWStringToString(file_names.front()));
+ webkit_glue::FilePathStringToString(file_names.front().value()));
} else {
Vector<WebCore::String> paths;
- for (std::vector<std::wstring>::const_iterator filename =
+ for (std::vector<FilePath>::const_iterator filename =
file_names.begin(); filename != file_names.end(); ++filename) {
- paths.append(webkit_glue::StdWStringToString(*filename));
+ paths.append(webkit_glue::FilePathStringToString((*filename).value()));
}
file_chooser_->chooseFiles(paths);
}
diff --git a/webkit/glue/context_menu_unittest.cc b/webkit/glue/context_menu_unittest.cc
index b7ff8ed..8e62c2c 100644
--- a/webkit/glue/context_menu_unittest.cc
+++ b/webkit/glue/context_menu_unittest.cc
@@ -7,6 +7,7 @@
#include <vector>
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/message_loop.h"
#include "webkit/glue/webframe.h"
@@ -24,12 +25,12 @@ class ContextMenuCapturing : public TestShellTest {
TestShellTest::SetUp();
iframes_data_dir_ = data_dir_;
- file_util::AppendToPath(&iframes_data_dir_, L"test_shell");
- file_util::AppendToPath(&iframes_data_dir_, L"iframes");
+ iframes_data_dir_ = iframes_data_dir_.AppendASCII("test_shell");
+ iframes_data_dir_ = iframes_data_dir_.AppendASCII("iframes");
ASSERT_TRUE(file_util::PathExists(iframes_data_dir_));
}
- std::wstring iframes_data_dir_;
+ FilePath iframes_data_dir_;
};
@@ -40,7 +41,7 @@ TEST_F(ContextMenuCapturing, ContextMenuCapturing) {
test_delegate->clear_captured_context_menu_events();
EXPECT_EQ(0U, test_delegate->captured_context_menu_events().size());
- std::wstring test_url = GetTestURL(iframes_data_dir_, L"testiframe.html");
+ std::wstring test_url = GetTestURL(iframes_data_dir_, "testiframe.html");
test_shell_->LoadURL(test_url.c_str());
test_shell_->WaitTestFinished();
diff --git a/webkit/glue/dom_operations_unittest.cc b/webkit/glue/dom_operations_unittest.cc
index e960375..0ebf1b4 100644
--- a/webkit/glue/dom_operations_unittest.cc
+++ b/webkit/glue/dom_operations_unittest.cc
@@ -20,7 +20,7 @@ class DomOperationsTests : public TestShellTest {
// Test function GetAllSavableResourceLinksForCurrentPage with a web page.
// We expect result of GetAllSavableResourceLinksForCurrentPage exactly
// matches expected_resources_set.
- void GetSavableResourceLinksForPage(const std::wstring& page_file_path,
+ void GetSavableResourceLinksForPage(const FilePath& page_file_path,
const std::set<GURL>& expected_resources_set);
protected:
@@ -36,7 +36,7 @@ class DomOperationsTests : public TestShellTest {
void DomOperationsTests::GetSavableResourceLinksForPage(
- const std::wstring& page_file_path,
+ const FilePath& page_file_path,
const std::set<GURL>& expected_resources_set) {
// Convert local file path to file URL.
GURL file_url = net::FilePathToFileURL(page_file_path);
@@ -75,30 +75,29 @@ void DomOperationsTests::GetSavableResourceLinksForPage(
TEST_F(DomOperationsTests, GetSavableResourceLinksWithPageHasValidLinks) {
std::set<GURL> expected_resources_set;
// Set directory of test data.
- std::wstring page_file_path = data_dir_;
- file_util::AppendToPath(&page_file_path, L"dom_serializer");
+ FilePath page_file_path = data_dir_.AppendASCII("dom_serializer");
const char* expected_sub_resource_links[] = {
"file:///c:/yt/css/base_all-vfl36460.css",
"file:///c:/yt/js/base_all_with_bidi-vfl36451.js",
"file:///c:/yt/img/pixel-vfl73.gif"
};
- const wchar_t* expected_frame_links[] = {
- L"youtube_1.htm",
- L"youtube_2.htm"
+ const char* expected_frame_links[] = {
+ "youtube_1.htm",
+ "youtube_2.htm"
};
// Add all expected links of sub-resource to expected set.
for (size_t i = 0; i < arraysize(expected_sub_resource_links); ++i)
expected_resources_set.insert(GURL(expected_sub_resource_links[i]));
// Add all expected links of frame to expected set.
for (size_t i = 0; i < arraysize(expected_frame_links); ++i) {
- std::wstring expected_frame_url = page_file_path;
- file_util::AppendToPath(&expected_frame_url, expected_frame_links[i]);
+ const FilePath expected_frame_url =
+ page_file_path.AppendASCII(expected_frame_links[i]);
expected_resources_set.insert(
net::FilePathToFileURL(expected_frame_url));
}
- file_util::AppendToPath(&page_file_path, std::wstring(L"youtube_1.htm"));
+ page_file_path = page_file_path.AppendASCII("youtube_1.htm");
GetSavableResourceLinksForPage(page_file_path, expected_resources_set);
}
@@ -107,21 +106,20 @@ TEST_F(DomOperationsTests, GetSavableResourceLinksWithPageHasValidLinks) {
TEST_F(DomOperationsTests, GetSavableResourceLinksWithPageHasInvalidLinks) {
std::set<GURL> expected_resources_set;
// Set directory of test data.
- std::wstring page_file_path = data_dir_;
- file_util::AppendToPath(&page_file_path, L"dom_serializer");
+ FilePath page_file_path = data_dir_.AppendASCII("dom_serializer");
- const wchar_t* expected_frame_links[] = {
- L"youtube_2.htm"
+ const char* expected_frame_links[] = {
+ "youtube_2.htm"
};
// Add all expected links of frame to expected set.
for (size_t i = 0; i < arraysize(expected_frame_links); ++i) {
- std::wstring expected_frame_url = page_file_path;
- file_util::AppendToPath(&expected_frame_url, expected_frame_links[i]);
+ FilePath expected_frame_url =
+ page_file_path.AppendASCII(expected_frame_links[i]);
expected_resources_set.insert(
net::FilePathToFileURL(expected_frame_url));
}
- file_util::AppendToPath(&page_file_path, std::wstring(L"youtube_2.htm"));
+ page_file_path = page_file_path.AppendASCII("youtube_2.htm");
GetSavableResourceLinksForPage(page_file_path, expected_resources_set);
}
diff --git a/webkit/glue/dom_serializer_unittest.cc b/webkit/glue/dom_serializer_unittest.cc
index 03afe5b..34a04a8 100644
--- a/webkit/glue/dom_serializer_unittest.cc
+++ b/webkit/glue/dom_serializer_unittest.cc
@@ -238,8 +238,9 @@ bool IsMetaElement(const WebCore::Node* node, WebCore::String* charset_info) {
// If original contents have document type, the serialized contents also have
// document type.
TEST_F(DomSerializerTests, SerialzeHTMLDOMWithDocType) {
- std::wstring page_file_path = data_dir_;
- file_util::AppendToPath(&page_file_path, L"dom_serializer/youtube_1.htm");
+ FilePath page_file_path = data_dir_;
+ page_file_path = page_file_path.AppendASCII("dom_serializer");
+ page_file_path = page_file_path.AppendASCII("youtube_1.htm");
GURL file_url = net::FilePathToFileURL(page_file_path);
ASSERT_TRUE(file_url.SchemeIsFile());
// Load the test file.
@@ -269,8 +270,9 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithDocType) {
// If original contents do not have document type, the serialized contents
// also do not have document type.
TEST_F(DomSerializerTests, SerialzeHTMLDOMWithoutDocType) {
- std::wstring page_file_path = data_dir_;
- file_util::AppendToPath(&page_file_path, L"dom_serializer/youtube_2.htm");
+ FilePath page_file_path = data_dir_;
+ page_file_path = page_file_path.AppendASCII("dom_serializer");
+ page_file_path = page_file_path.AppendASCII("youtube_2.htm");
GURL file_url = net::FilePathToFileURL(page_file_path);
ASSERT_TRUE(file_url.SchemeIsFile());
// Load the test file.
@@ -301,8 +303,9 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithoutDocType) {
// finishing serialization, the serialized contents should be same
// with original XML document.
TEST_F(DomSerializerTests, SerialzeXMLDocWithBuiltInEntities) {
- std::wstring page_file_path = data_dir_;
- file_util::AppendToPath(&page_file_path, L"dom_serializer/note.xml");
+ FilePath page_file_path = data_dir_;
+ page_file_path = page_file_path.AppendASCII("dom_serializer");
+ page_file_path = page_file_path.AppendASCII("note.xml");
// Read original contents for later comparison.
std::string orginal_contents;
ASSERT_TRUE(file_util::ReadFileToString(page_file_path, &orginal_contents));
@@ -322,8 +325,9 @@ TEST_F(DomSerializerTests, SerialzeXMLDocWithBuiltInEntities) {
// When serializing DOM, we add MOTW declaration before html tag.
TEST_F(DomSerializerTests, SerialzeHTMLDOMWithAddingMOTW) {
- std::wstring page_file_path = data_dir_;
- file_util::AppendToPath(&page_file_path, L"dom_serializer/youtube_2.htm");
+ FilePath page_file_path = data_dir_;
+ page_file_path = page_file_path.AppendASCII("dom_serializer");
+ page_file_path = page_file_path.AppendASCII("youtube_2.htm");
// Read original contents for later comparison .
std::string orginal_contents;
ASSERT_TRUE(file_util::ReadFileToString(page_file_path, &orginal_contents));
@@ -355,8 +359,9 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithAddingMOTW) {
// http://bugs.webkit.org/show_bug.cgi?id=16621 even the original document
// does not have META charset declaration.
TEST_F(DomSerializerTests, SerialzeHTMLDOMWithNoMetaCharsetInOriginalDoc) {
- std::wstring page_file_path = data_dir_;
- file_util::AppendToPath(&page_file_path, L"dom_serializer/youtube_1.htm");
+ FilePath page_file_path = data_dir_;
+ page_file_path = page_file_path.AppendASCII("dom_serializer");
+ page_file_path = page_file_path.AppendASCII("youtube_1.htm");
// Get file URL.
GURL file_url = net::FilePathToFileURL(page_file_path);
ASSERT_TRUE(file_url.SchemeIsFile());
@@ -417,8 +422,9 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithNoMetaCharsetInOriginalDoc) {
// declarations.
TEST_F(DomSerializerTests,
SerialzeHTMLDOMWithMultipleMetaCharsetInOriginalDoc) {
- std::wstring page_file_path = data_dir_;
- file_util::AppendToPath(&page_file_path, L"dom_serializer/youtube_2.htm");
+ FilePath page_file_path = data_dir_;
+ page_file_path = page_file_path.AppendASCII("dom_serializer");
+ page_file_path = page_file_path.AppendASCII("youtube_2.htm");
// Get file URL.
GURL file_url = net::FilePathToFileURL(page_file_path);
ASSERT_TRUE(file_url.SchemeIsFile());
@@ -480,9 +486,9 @@ TEST_F(DomSerializerTests,
// Test situation of html entities in text when serializing HTML DOM.
TEST_F(DomSerializerTests, SerialzeHTMLDOMWithEntitiesInText) {
- std::wstring page_file_path = data_dir_;
- file_util::AppendToPath(&page_file_path,
- L"dom_serializer/htmlentities_in_text.htm");
+ FilePath page_file_path = data_dir_;
+ page_file_path = page_file_path.AppendASCII("dom_serializer");
+ page_file_path = page_file_path.AppendASCII("htmlentities_in_text.htm");
// Read original contents for later comparison .
std::string orginal_contents;
ASSERT_TRUE(file_util::ReadFileToString(page_file_path, &orginal_contents));
@@ -520,9 +526,10 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithEntitiesInText) {
// Test situation of html entities in attribute value when serializing
// HTML DOM.
TEST_F(DomSerializerTests, SerialzeHTMLDOMWithEntitiesInAttributeValue) {
- std::wstring page_file_path = data_dir_;
- file_util::AppendToPath(&page_file_path,
- L"dom_serializer/htmlentities_in_attribute_value.htm");
+ FilePath page_file_path = data_dir_;
+ page_file_path = page_file_path.AppendASCII("dom_serializer");
+ page_file_path =
+ page_file_path.AppendASCII("htmlentities_in_attribute_value.htm");
// Read original contents for later comparison.
std::string orginal_contents;
ASSERT_TRUE(file_util::ReadFileToString(page_file_path, &orginal_contents));
@@ -565,17 +572,16 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithBaseTag) {
// There are total 2 available base tags in this test file.
const int kTotalBaseTagCountInTestFile = 2;
- FilePath page_file_path = FilePath::FromWStringHack(data_dir_).AppendASCII(
- "dom_serializer");
+ FilePath page_file_path = data_dir_.AppendASCII("dom_serializer");
file_util::EnsureEndsWithSeparator(&page_file_path);
// Get page dir URL which is base URL of this file.
- GURL path_dir_url = net::FilePathToFileURL(page_file_path.ToWStringHack());
+ GURL path_dir_url = net::FilePathToFileURL(page_file_path);
// Get file path.
page_file_path =
page_file_path.AppendASCII("html_doc_has_base_tag.htm");
// Get file URL.
- GURL file_url = net::FilePathToFileURL(page_file_path.ToWStringHack());
+ GURL file_url = net::FilePathToFileURL(page_file_path);
ASSERT_TRUE(file_url.SchemeIsFile());
// Load the test file.
LoadPageFromURL(file_url);
diff --git a/webkit/glue/iframe_redirect_unittest.cc b/webkit/glue/iframe_redirect_unittest.cc
index 37be9a5..dc280e2 100644
--- a/webkit/glue/iframe_redirect_unittest.cc
+++ b/webkit/glue/iframe_redirect_unittest.cc
@@ -21,13 +21,12 @@ typedef TestShellTest IFrameRedirectTest;
// Tests that loading a page in an iframe from javascript results in
// a redirect from about:blank.
TEST_F(IFrameRedirectTest, Test) {
- std::wstring iframes_data_dir_ = data_dir_;
-
- file_util::AppendToPath(&iframes_data_dir_, L"test_shell");
- file_util::AppendToPath(&iframes_data_dir_, L"iframe_redirect");
+ FilePath iframes_data_dir_ = data_dir_;
+ iframes_data_dir_ = iframes_data_dir_.AppendASCII("test_shell");
+ iframes_data_dir_ = iframes_data_dir_.AppendASCII("iframe_redirect");
ASSERT_TRUE(file_util::PathExists(iframes_data_dir_));
- std::wstring test_url = GetTestURL(iframes_data_dir_, L"main.html");
+ std::wstring test_url = GetTestURL(iframes_data_dir_, "main.html");
test_shell_->LoadURL(test_url.c_str());
test_shell_->WaitTestFinished();
diff --git a/webkit/glue/plugins/plugin_host.cc b/webkit/glue/plugins/plugin_host.cc
index b87160a..bfefd0b 100644
--- a/webkit/glue/plugins/plugin_host.cc
+++ b/webkit/glue/plugins/plugin_host.cc
@@ -450,7 +450,9 @@ static NPError PostURLNotify(NPP id,
if (StartsWithASCII(file_path_ascii, kFileUrlPrefix, false)) {
GURL file_url(file_path_ascii);
DCHECK(file_url.SchemeIsFile());
- net::FileURLToFilePath(file_url, &file_path);
+ FilePath path;
+ net::FileURLToFilePath(file_url, &path);
+ file_path = path.ToWStringHack();
} else {
file_path = base::SysNativeMBToWide(file_path_ascii);
}
diff --git a/webkit/glue/resource_handle_impl.cc b/webkit/glue/resource_handle_impl.cc
index 523a293..7b1e6a3 100644
--- a/webkit/glue/resource_handle_impl.cc
+++ b/webkit/glue/resource_handle_impl.cc
@@ -451,7 +451,7 @@ bool ResourceHandleInternal::Start(
}
} else {
bridge_->AppendFileToUpload(
- webkit_glue::StringToStdWString(e.m_filename));
+ FilePath(webkit_glue::StringToFilePathString(e.m_filename)));
}
}
bridge_->SetUploadIdentifier(request_.httpBody()->identifier());
diff --git a/webkit/glue/resource_loader_bridge.h b/webkit/glue/resource_loader_bridge.h
index 07508d5..f006974 100644
--- a/webkit/glue/resource_loader_bridge.h
+++ b/webkit/glue/resource_loader_bridge.h
@@ -21,6 +21,7 @@
#if defined(OS_POSIX)
#include "base/file_descriptor_posix.h"
#endif
+#include "base/file_path.h"
#include "base/platform_file.h"
#include "base/ref_counted.h"
#include "base/time.h"
@@ -192,13 +193,13 @@ class ResourceLoaderBridge {
// Call this method before calling Start() to append the contents of a file
// to the request body. May only be used with HTTP(S) POST requests.
- void AppendFileToUpload(const std::wstring& file_path) {
+ void AppendFileToUpload(const FilePath& file_path) {
AppendFileRangeToUpload(file_path, 0, kuint64max);
}
// Call this method before calling Start() to append the contents of a file
// to the request body. May only be used with HTTP(S) POST requests.
- virtual void AppendFileRangeToUpload(const std::wstring& file_path,
+ virtual void AppendFileRangeToUpload(const FilePath& file_path,
uint64 offset, uint64 length) = 0;
// Call this method before calling Start() to assign an upload identifier to
diff --git a/webkit/glue/weburlrequest_impl.cc b/webkit/glue/weburlrequest_impl.cc
index cf30f7e3..655eb0f 100644
--- a/webkit/glue/weburlrequest_impl.cc
+++ b/webkit/glue/weburlrequest_impl.cc
@@ -172,7 +172,8 @@ void WebRequestImpl::GetUploadData(net::UploadData* data) const {
if (element.m_type == WebCore::FormDataElement::data) {
data->AppendBytes(element.m_data.data(), element.m_data.size());
} else if (element.m_type == WebCore::FormDataElement::encodedFile) {
- data->AppendFile(webkit_glue::StringToStdWString(element.m_filename));
+ data->AppendFile(
+ FilePath(webkit_glue::StringToFilePathString(element.m_filename)));
} else {
NOTREACHED();
}
@@ -195,7 +196,7 @@ void WebRequestImpl::SetUploadData(const net::UploadData& data)
element.bytes().size());
} else if (element.type() == net::UploadData::TYPE_FILE) {
formdata->appendFile(
- webkit_glue::StdWStringToString(element.file_path()));
+ webkit_glue::FilePathStringToString(element.file_path().value()));
} else {
NOTREACHED();
}
diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h
index 03e1a78..c206ef8 100644
--- a/webkit/glue/webview_delegate.h
+++ b/webkit/glue/webview_delegate.h
@@ -28,6 +28,7 @@
#include <vector>
+#include "base/file_path.h"
#include "webkit/glue/context_menu.h"
#include "webkit/glue/webdatasource.h"
#include "webkit/glue/webwidget_delegate.h"
diff --git a/webkit/tools/test_shell/simple_resource_loader_bridge.cc b/webkit/tools/test_shell/simple_resource_loader_bridge.cc
index 755a6f6..fd409a0 100644
--- a/webkit/tools/test_shell/simple_resource_loader_bridge.cc
+++ b/webkit/tools/test_shell/simple_resource_loader_bridge.cc
@@ -456,7 +456,7 @@ class ResourceLoaderBridgeImpl : public ResourceLoaderBridge {
params_->upload->AppendBytes(data, data_len);
}
- virtual void AppendFileRangeToUpload(const std::wstring& file_path,
+ virtual void AppendFileRangeToUpload(const FilePath& file_path,
uint64 offset, uint64 length) {
DCHECK(params_.get());
if (!params_->upload)
diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc
index 7083d7c..1041bdd 100644
--- a/webkit/tools/test_shell/test_shell_gtk.cc
+++ b/webkit/tools/test_shell/test_shell_gtk.cc
@@ -570,7 +570,7 @@ void TestShell::LoadURLForFrame(const wchar_t* url,
// PathExists will reject any string with no leading '/'
// as well as empty strings.
if (file_util::AbsolutePath(&path))
- gurl = net::FilePathToFileURL(path);
+ gurl = net::FilePathToFileURL(FilePath::FromWStringHack(path));
else
gurl = GURL(WideToUTF8(url));
diff --git a/webkit/tools/test_shell/test_shell_test.cc b/webkit/tools/test_shell/test_shell_test.cc
index 1ce279a..c6e7ac4 100644
--- a/webkit/tools/test_shell/test_shell_test.cc
+++ b/webkit/tools/test_shell/test_shell_test.cc
@@ -4,16 +4,18 @@
#include "webkit/tools/test_shell/test_shell_test.h"
+#include <string>
+
#include "base/basictypes.h"
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/string_util.h"
-std::wstring TestShellTest::GetTestURL(std::wstring test_case_path,
- const std::wstring& test_case) {
- file_util::AppendToPath(&test_case_path, test_case);
- return test_case_path;
+std::wstring TestShellTest::GetTestURL(const FilePath& test_case_path,
+ const std::string& test_case) {
+ return test_case_path.AppendASCII(test_case).ToWStringHack();
}
void TestShellTest::SetUp() {
@@ -23,8 +25,8 @@ void TestShellTest::SetUp() {
// Point data_dir_ to the root of the test case dir
ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir_));
- file_util::AppendToPath(&data_dir_, L"webkit");
- file_util::AppendToPath(&data_dir_, L"data");
+ data_dir_ = data_dir_.Append(FILE_PATH_LITERAL("webkit"));
+ data_dir_ = data_dir_.Append(FILE_PATH_LITERAL("data"));
ASSERT_TRUE(file_util::PathExists(data_dir_));
}
diff --git a/webkit/tools/test_shell/test_shell_test.h b/webkit/tools/test_shell/test_shell_test.h
index 2cdd792..4e6372b 100644
--- a/webkit/tools/test_shell/test_shell_test.h
+++ b/webkit/tools/test_shell/test_shell_test.h
@@ -10,6 +10,9 @@
#ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_TEST_H__
#define WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_TEST_H__
+#include <string>
+
+#include "base/file_path.h"
#include "webkit/glue/window_open_disposition.h"
#include "webkit/tools/test_shell/test_shell.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -17,8 +20,8 @@
class TestShellTest : public testing::Test {
protected:
// Returns the path "test_case_path/test_case".
- std::wstring GetTestURL(std::wstring test_case_path,
- const std::wstring& test_case);
+ std::wstring GetTestURL(const FilePath& test_case_path,
+ const std::string& test_case);
virtual void SetUp();
virtual void TearDown();
@@ -30,7 +33,7 @@ class TestShellTest : public testing::Test {
protected:
// Location of SOURCE_ROOT/webkit/data/
- std::wstring data_dir_;
+ FilePath data_dir_;
TestShell* test_shell_;
};