summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-09 21:46:15 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-09 21:46:15 +0000
commit3683cbb58a3e46cc3bb3860268e7bcf6ca499a0b (patch)
treec72557a7a4f3f24328757dd3c658b58865b57c0c /chrome
parentb3d7a18cfceb5305aa563a321408665e4d7d3d12 (diff)
downloadchromium_src-3683cbb58a3e46cc3bb3860268e7bcf6ca499a0b.zip
chromium_src-3683cbb58a3e46cc3bb3860268e7bcf6ca499a0b.tar.gz
chromium_src-3683cbb58a3e46cc3bb3860268e7bcf6ca499a0b.tar.bz2
UI test portage, second try.
first try here: <http://codereview.chromium.org/63149> Review URL: http://codereview.chromium.org/67006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13464 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/automation/automation_provider.cc7
-rw-r--r--chrome/browser/automation/automation_provider.h3
-rw-r--r--chrome/browser/automation/url_request_slow_download_job.cc20
-rw-r--r--chrome/browser/automation/url_request_slow_download_job.h6
-rw-r--r--chrome/browser/crash_recovery_uitest.cc7
-rw-r--r--chrome/browser/download/download_uitest.cc89
-rw-r--r--chrome/browser/download/save_page_uitest.cc112
-rw-r--r--chrome/browser/sessions/session_restore_uitest.cc2
-rw-r--r--chrome/browser/tab_restore_uitest.cc4
-rw-r--r--chrome/common/temp_scaffolding_stubs.cc4
-rw-r--r--chrome/test/automation/automation_messages_internal.h2
-rw-r--r--chrome/test/automation/automation_proxy.cc4
-rw-r--r--chrome/test/automation/automation_proxy.h6
13 files changed, 141 insertions, 125 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 81d0137..067302a 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -2100,17 +2100,14 @@ void AutomationProvider::GetDownloadDirectory(
}
}
-#if defined(OS_WIN)
-// TODO(port): Remove windowsisms.
-void AutomationProvider::OpenNewBrowserWindow(int show_command) {
+void AutomationProvider::OpenNewBrowserWindow(bool show) {
// We may have no current browser windows open so don't rely on
// asking an existing browser to execute the IDC_NEWWINDOW command
Browser* browser = Browser::Create(profile_);
browser->AddBlankTab(true);
- if (show_command != SW_HIDE)
+ if (show)
browser->window()->Show();
}
-#endif // defined(OS_WIN)
void AutomationProvider::GetWindowForBrowser(int browser_handle,
bool* success,
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index 0c4f876..eafd5fe 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -266,7 +266,8 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
void GetAutocompleteEditForBrowser(int browser_handle, bool* success,
int* autocomplete_edit_handle);
- void OpenNewBrowserWindow(int show_command);
+ // If |show| is true, call Show() on the new window after creating it.
+ void OpenNewBrowserWindow(bool show);
void ShowInterstitialPage(int tab_handle,
const std::string& html_text,
diff --git a/chrome/browser/automation/url_request_slow_download_job.cc b/chrome/browser/automation/url_request_slow_download_job.cc
index a4b7c6f..630eca1 100644
--- a/chrome/browser/automation/url_request_slow_download_job.cc
+++ b/chrome/browser/automation/url_request_slow_download_job.cc
@@ -14,12 +14,12 @@
const int kFirstDownloadSize = 1024 * 35;
const int kSecondDownloadSize = 1024 * 10;
-const wchar_t URLRequestSlowDownloadJob::kUnknownSizeUrl[] =
- L"http://url.handled.by.slow.download/download-unknown-size";
-const wchar_t URLRequestSlowDownloadJob::kKnownSizeUrl[] =
- L"http://url.handled.by.slow.download/download-known-size";
-const wchar_t URLRequestSlowDownloadJob::kFinishDownloadUrl[] =
- L"http://url.handled.by.slow.download/download-finish";
+const char URLRequestSlowDownloadJob::kUnknownSizeUrl[] =
+ "http://url.handled.by.slow.download/download-unknown-size";
+const char URLRequestSlowDownloadJob::kKnownSizeUrl[] =
+ "http://url.handled.by.slow.download/download-known-size";
+const char URLRequestSlowDownloadJob::kFinishDownloadUrl[] =
+ "http://url.handled.by.slow.download/download-finish";
std::vector<URLRequestSlowDownloadJob*>
URLRequestSlowDownloadJob::kPendingRequests;
@@ -32,11 +32,11 @@ void URLRequestSlowDownloadJob::Start() {
/* static */
void URLRequestSlowDownloadJob::AddUITestUrls() {
URLRequestFilter* filter = URLRequestFilter::GetInstance();
- filter->AddUrlHandler(GURL(WideToUTF8(kUnknownSizeUrl)),
+ filter->AddUrlHandler(GURL(kUnknownSizeUrl),
&URLRequestSlowDownloadJob::Factory);
- filter->AddUrlHandler(GURL(WideToUTF8(kKnownSizeUrl)),
+ filter->AddUrlHandler(GURL(kKnownSizeUrl),
&URLRequestSlowDownloadJob::Factory);
- filter->AddUrlHandler(GURL(WideToUTF8(kFinishDownloadUrl)),
+ filter->AddUrlHandler(GURL(kFinishDownloadUrl),
&URLRequestSlowDownloadJob::Factory);
}
@@ -44,7 +44,7 @@ void URLRequestSlowDownloadJob::AddUITestUrls() {
URLRequestJob* URLRequestSlowDownloadJob::Factory(URLRequest* request,
const std::string& scheme) {
URLRequestSlowDownloadJob* job = new URLRequestSlowDownloadJob(request);
- if (request->url().spec() != WideToUTF8(kFinishDownloadUrl))
+ if (request->url().spec() != kFinishDownloadUrl)
URLRequestSlowDownloadJob::kPendingRequests.push_back(job);
return job;
}
diff --git a/chrome/browser/automation/url_request_slow_download_job.h b/chrome/browser/automation/url_request_slow_download_job.h
index 29cf57a..eee858a 100644
--- a/chrome/browser/automation/url_request_slow_download_job.h
+++ b/chrome/browser/automation/url_request_slow_download_job.h
@@ -32,9 +32,9 @@ class URLRequestSlowDownloadJob : public URLRequestJob {
const std::string& scheme);
// Test URLs.
- static const wchar_t kUnknownSizeUrl[];
- static const wchar_t kKnownSizeUrl[];
- static const wchar_t kFinishDownloadUrl[];
+ static const char kUnknownSizeUrl[];
+ static const char kKnownSizeUrl[];
+ static const char kFinishDownloadUrl[];
// For UI tests: adds the testing URLs to the URLRequestFilter.
static void AddUITestUrls();
diff --git a/chrome/browser/crash_recovery_uitest.cc b/chrome/browser/crash_recovery_uitest.cc
index bbd577a..994661b 100644
--- a/chrome/browser/crash_recovery_uitest.cc
+++ b/chrome/browser/crash_recovery_uitest.cc
@@ -4,6 +4,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
+#include "base/platform_thread.h"
#include "chrome/test/automation/browser_proxy.h"
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/ui/ui_test.h"
@@ -33,7 +34,8 @@ TEST_F(CrashRecoveryUITest, Reload) {
expected_crashes_ = 1;
tab->NavigateToURLAsync(GURL("about:crash"));
- Sleep(1000); // Wait for the browser to notice the renderer crash.
+ // Wait for the browser to notice the renderer crash.
+ PlatformThread::Sleep(1000);
tab->Reload();
@@ -66,7 +68,8 @@ TEST_F(CrashRecoveryUITest, LoadInNewTab) {
expected_crashes_ = 1;
tab->NavigateToURLAsync(GURL("about:crash"));
- Sleep(1000); // Wait for the browser to notice the renderer crash.
+ // Wait for the browser to notice the renderer crash.
+ PlatformThread::Sleep(1000);
scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser_proxy->AppendTab(url));
diff --git a/chrome/browser/download/download_uitest.cc b/chrome/browser/download/download_uitest.cc
index 941910a..debf209 100644
--- a/chrome/browser/download/download_uitest.cc
+++ b/chrome/browser/download/download_uitest.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <shlwapi.h>
#include <sstream>
#include <string>
@@ -19,14 +18,14 @@
#include "chrome/test/ui/ui_test.h"
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/automation/browser_proxy.h"
+#include "net/base/net_util.h"
#include "net/url_request/url_request_unittest.h"
-using std::wstring;
-
namespace {
const wchar_t kDocRoot[] = L"chrome/test/data";
+#if defined(OS_WIN)
// Checks if the volume supports Alternate Data Streams. This is required for
// the Zone Identifier implementation.
bool VolumeSupportsADS(const std::wstring path) {
@@ -64,56 +63,56 @@ void CheckZoneIdentifier(const std::wstring full_path) {
ASSERT_EQ(0, strcmp(kIdentifier, buffer));
}
+#endif // defined(OS_WIN)
class DownloadTest : public UITest {
protected:
DownloadTest() : UITest() {}
- void CleanUpDownload(const std::wstring& client_filename,
- const std::wstring& server_filename) {
+ void CleanUpDownload(const FilePath& client_filename,
+ const FilePath& server_filename) {
// Find the path on the client.
- std::wstring file_on_client(download_prefix_);
- file_on_client.append(client_filename);
+ FilePath file_on_client = download_prefix_.Append(client_filename);
EXPECT_TRUE(file_util::PathExists(file_on_client));
// Find the path on the server.
- std::wstring file_on_server;
+ FilePath file_on_server;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA,
&file_on_server));
- file_on_server.append(L"\\");
- file_on_server.append(server_filename);
+ file_on_server = file_on_server.Append(server_filename);
ASSERT_TRUE(file_util::PathExists(file_on_server));
// Check that we downloaded the file correctly.
EXPECT_TRUE(file_util::ContentsEqual(file_on_server,
file_on_client));
- // Check if the Zone Identifier is correclty set.
- if (VolumeSupportsADS(file_on_client))
- CheckZoneIdentifier(file_on_client);
+#if defined(OS_WIN)
+ // Check if the Zone Identifier is correctly set.
+ if (VolumeSupportsADS(file_on_client.value()))
+ CheckZoneIdentifier(file_on_client.value());
+#endif
// Delete the client copy of the file.
EXPECT_TRUE(file_util::Delete(file_on_client, false));
}
- void CleanUpDownload(const std::wstring& file) {
+ void CleanUpDownload(const FilePath& file) {
CleanUpDownload(file, file);
}
virtual void SetUp() {
UITest::SetUp();
- download_prefix_ = GetDownloadDirectory();
- download_prefix_ += FilePath::kSeparators[0];
+ download_prefix_ = FilePath::FromWStringHack(GetDownloadDirectory());
}
protected:
- void RunSizeTest(const wstring& url,
- const wstring& expected_title_in_progress,
- const wstring& expected_title_finished) {
+ void RunSizeTest(const GURL& url,
+ const std::wstring& expected_title_in_progress,
+ const std::wstring& expected_title_finished) {
{
EXPECT_EQ(1, GetTabCount());
- NavigateToURL(GURL(url));
+ NavigateToURL(url);
// Downloads appear in the shelf
WaitUntilTabCount(1);
// TODO(tc): check download status text
@@ -132,19 +131,22 @@ class DownloadTest : public UITest {
EXPECT_TRUE(WaitForDownloadShelfVisible(dl_tab.get()));
}
- std::wstring filename = file_util::GetFilenameFromPath(url);
- EXPECT_TRUE(file_util::PathExists(download_prefix_ + filename));
+ FilePath filename;
+ net::FileURLToFilePath(url, &filename);
+ filename = filename.BaseName();
+ FilePath download_path = download_prefix_.Append(filename);
+ EXPECT_TRUE(file_util::PathExists(download_path));
// Delete the file we just downloaded.
for (int i = 0; i < 10; ++i) {
- if (file_util::Delete(download_prefix_ + filename, false))
+ if (file_util::Delete(download_path, false))
break;
PlatformThread::Sleep(action_max_timeout_ms() / 10);
}
- EXPECT_FALSE(file_util::PathExists(download_prefix_ + filename));
+ EXPECT_FALSE(file_util::PathExists(download_path));
}
- wstring download_prefix_;
+ FilePath download_prefix_;
};
} // namespace
@@ -152,12 +154,11 @@ class DownloadTest : public UITest {
// Download a file with non-viewable content, verify that the
// download tab opened and the file exists.
TEST_F(DownloadTest, DownloadMimeType) {
- wstring file = L"download-test1.lib";
- wstring expected_title = L"100% - " + file;
+ FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
EXPECT_EQ(1, GetTabCount());
- NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file));
+ NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file.ToWStringHack()));
// No new tabs created, downloads appear in the current tab's download shelf.
WaitUntilTabCount(1);
@@ -174,16 +175,15 @@ TEST_F(DownloadTest, DownloadMimeType) {
// Access a file with a viewable mime-type, verify that a download
// did not initiate.
TEST_F(DownloadTest, NoDownload) {
- wstring file = L"download-test2.html";
- wstring file_path = download_prefix_;
- file_util::AppendToPath(&file_path, file);
+ FilePath file(FILE_PATH_LITERAL("download-test2.html"));
+ FilePath file_path = download_prefix_.Append(file);
if (file_util::PathExists(file_path))
ASSERT_TRUE(file_util::Delete(file_path, false));
EXPECT_EQ(1, GetTabCount());
- NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file));
+ NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file.ToWStringHack()));
WaitUntilTabCount(1);
// Wait to see if the file will be downloaded.
@@ -202,13 +202,12 @@ TEST_F(DownloadTest, NoDownload) {
// download tab opened and the file exists as the filename specified in the
// header. This also ensures we properly handle empty file downloads.
TEST_F(DownloadTest, ContentDisposition) {
- wstring file = L"download-test3.gif";
- wstring download_file = L"download-test3-attachment.gif";
- wstring expected_title = L"100% - " + download_file;
+ FilePath file(FILE_PATH_LITERAL("download-test3.gif"));
+ FilePath download_file(FILE_PATH_LITERAL("download-test3-attachment.gif"));
EXPECT_EQ(1, GetTabCount());
- NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file));
+ NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file.ToWStringHack()));
WaitUntilTabCount(1);
// Wait until the file is downloaded.
@@ -229,14 +228,20 @@ TEST_F(DownloadTest, ContentDisposition) {
// in the middle until the server receives a second request for
// "download-finish. At that time, the download will finish.
TEST_F(DownloadTest, UnknownSize) {
- std::wstring url(URLRequestSlowDownloadJob::kUnknownSizeUrl);
- std::wstring filename = file_util::GetFilenameFromPath(url);
- RunSizeTest(url, L"32.0 KB - " + filename, L"100% - " + filename);
+ GURL url(URLRequestSlowDownloadJob::kUnknownSizeUrl);
+ FilePath filename;
+ net::FileURLToFilePath(url, &filename);
+ filename = filename.BaseName();
+ RunSizeTest(url, L"32.0 KB - " + filename.ToWStringHack(),
+ L"100% - " + filename.ToWStringHack());
}
// http://b/1158253
TEST_F(DownloadTest, DISABLED_KnownSize) {
- std::wstring url(URLRequestSlowDownloadJob::kKnownSizeUrl);
- std::wstring filename = file_util::GetFilenameFromPath(url);
- RunSizeTest(url, L"71% - " + filename, L"100% - " + filename);
+ GURL url(URLRequestSlowDownloadJob::kKnownSizeUrl);
+ FilePath filename;
+ net::FileURLToFilePath(url, &filename);
+ filename = filename.BaseName();
+ RunSizeTest(url, L"71% - " + filename.ToWStringHack(),
+ L"100% - " + filename.ToWStringHack());
}
diff --git a/chrome/browser/download/save_page_uitest.cc b/chrome/browser/download/save_page_uitest.cc
index 78e3759..f9a2036 100644
--- a/chrome/browser/download/save_page_uitest.cc
+++ b/chrome/browser/download/save_page_uitest.cc
@@ -4,6 +4,7 @@
#include "base/file_util.h"
#include "base/path_service.h"
+#include "base/platform_thread.h"
#include "base/string_util.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/automation/url_request_mock_http_job.h"
@@ -14,14 +15,14 @@
#include "chrome/test/ui/ui_test.h"
#include "net/url_request/url_request_unittest.h"
-const std::wstring kTestDir = L"save_page";
+const std::string kTestDir = "save_page";
class SavePageTest : public UITest {
protected:
SavePageTest() : UITest() {}
- void CheckFile(const std::wstring& client_file,
- const std::wstring& server_file,
+ void CheckFile(const FilePath& client_file,
+ const FilePath& server_file,
bool check_equal) {
bool exist = false;
for (int i = 0; i < 20; ++i) {
@@ -29,15 +30,16 @@ class SavePageTest : public UITest {
exist = true;
break;
}
- Sleep(sleep_timeout_ms());
+ PlatformThread::Sleep(sleep_timeout_ms());
}
EXPECT_TRUE(exist);
if (check_equal) {
- std::wstring server_file_name;
+ FilePath server_file_name;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA,
&server_file_name));
- server_file_name += L"\\" + kTestDir + L"\\" + server_file;
+ server_file_name = server_file_name.AppendASCII(kTestDir)
+ .Append(server_file);
ASSERT_TRUE(file_util::PathExists(server_file_name));
int64 client_file_size = 0;
@@ -53,11 +55,10 @@ class SavePageTest : public UITest {
virtual void SetUp() {
UITest::SetUp();
- EXPECT_TRUE(file_util::CreateNewTempDirectory(L"", &save_dir_));
- save_dir_ += FilePath::kSeparators[0];
+ EXPECT_TRUE(file_util::CreateNewTempDirectory(FILE_PATH_LITERAL(""),
+ &save_dir_));
- download_dir_ = GetDownloadDirectory();
- download_dir_ += FilePath::kSeparators[0];
+ download_dir_ = FilePath::FromWStringHack(GetDownloadDirectory());
}
virtual void TearDown() {
@@ -65,70 +66,78 @@ class SavePageTest : public UITest {
DieFileDie(save_dir_, true);
}
- std::wstring save_dir_;
- std::wstring download_dir_;
+ FilePath save_dir_;
+ FilePath download_dir_;
};
TEST_F(SavePageTest, SaveHTMLOnly) {
- std::wstring file_name = L"a.htm";
- std::wstring full_file_name = save_dir_ + file_name;
- std::wstring dir = save_dir_ + L"a_files";
+ std::string file_name("a.htm");
+ FilePath full_file_name = save_dir_.AppendASCII(file_name);
+ FilePath dir = save_dir_.AppendASCII("a_files");
- GURL url = URLRequestMockHTTPJob::GetMockUrl(kTestDir + L"/" + file_name);
+ GURL url = URLRequestMockHTTPJob::GetMockUrl(
+ UTF8ToWide(kTestDir + "/" + file_name));
scoped_ptr<TabProxy> tab(GetActiveTab());
ASSERT_TRUE(tab->NavigateToURL(url));
WaitUntilTabCount(1);
- EXPECT_TRUE(tab->SavePage(full_file_name, dir,
- SavePackage::SAVE_AS_ONLY_HTML));
+ EXPECT_TRUE(tab->SavePage(full_file_name.ToWStringHack(), dir.ToWStringHack(),
+ SavePackage::SAVE_AS_ONLY_HTML));
EXPECT_TRUE(WaitForDownloadShelfVisible(tab.get()));
- CheckFile(full_file_name, file_name, true);
+ CheckFile(full_file_name, FilePath::FromWStringHack(UTF8ToWide(file_name)),
+ true);
EXPECT_FALSE(file_util::PathExists(dir));
}
TEST_F(SavePageTest, SaveCompleteHTML) {
- std::wstring file_name = L"b.htm";
- std::wstring full_file_name = save_dir_ + file_name;
- std::wstring dir = save_dir_ + L"b_files";
+ std::string file_name = "b.htm";
+ FilePath full_file_name = save_dir_.AppendASCII(file_name);
+ FilePath dir = save_dir_.AppendASCII("b_files");
- GURL url = URLRequestMockHTTPJob::GetMockUrl(kTestDir + L"/" + file_name);
+ GURL url = URLRequestMockHTTPJob::GetMockUrl(UTF8ToWide(kTestDir + "/" +
+ file_name));
scoped_ptr<TabProxy> tab(GetActiveTab());
ASSERT_TRUE(tab->NavigateToURL(url));
WaitUntilTabCount(1);
- EXPECT_TRUE(tab->SavePage(full_file_name, dir,
- SavePackage::SAVE_AS_COMPLETE_HTML));
+ EXPECT_TRUE(tab->SavePage(full_file_name.ToWStringHack(), dir.ToWStringHack(),
+ SavePackage::SAVE_AS_COMPLETE_HTML));
EXPECT_TRUE(WaitForDownloadShelfVisible(tab.get()));
- CheckFile(dir + L"\\1.png", L"1.png", true);
- CheckFile(dir + L"\\1.css", L"1.css", true);
- CheckFile(full_file_name, file_name, false);
+ CheckFile(dir.AppendASCII("1.png"), FilePath(FILE_PATH_LITERAL("1.png")),
+ true);
+ CheckFile(dir.AppendASCII("1.css"), FilePath(FILE_PATH_LITERAL("1.css")),
+ true);
+ CheckFile(full_file_name, FilePath::FromWStringHack(UTF8ToWide(file_name)),
+ false);
EXPECT_TRUE(DieFileDie(dir, true));
}
TEST_F(SavePageTest, NoSave) {
- std::wstring file_name = L"c.htm";
- std::wstring full_file_name = save_dir_ + file_name;
- std::wstring dir = save_dir_ + L"c_files";
+ std::string file_name = "c.htm";
+ FilePath full_file_name = save_dir_.AppendASCII(file_name);
+ FilePath dir = save_dir_.AppendASCII("c_files");
scoped_ptr<TabProxy> tab(GetActiveTab());
- ASSERT_TRUE(tab->NavigateToURL(GURL(L"about:blank")));
+ ASSERT_TRUE(tab->NavigateToURL(GURL("about:blank")));
WaitUntilTabCount(1);
- EXPECT_FALSE(tab->SavePage(full_file_name, dir,
- SavePackage::SAVE_AS_ONLY_HTML));
+ EXPECT_FALSE(tab->SavePage(full_file_name.ToWStringHack(),
+ dir.ToWStringHack(),
+ SavePackage::SAVE_AS_ONLY_HTML));
EXPECT_FALSE(WaitForDownloadShelfVisible(tab.get()));
}
TEST_F(SavePageTest, FilenameFromPageTitle) {
- std::wstring file_name = L"b.htm";
- std::wstring full_file_name = download_dir_ +
- L"Test page for saving page feature.htm";
- std::wstring dir = download_dir_ +
- L"Test page for saving page feature_files";
-
- GURL url = URLRequestMockHTTPJob::GetMockUrl(kTestDir + L"/" + file_name);
+ std::string file_name = "b.htm";
+ FilePath full_file_name = download_dir_.AppendASCII(
+ "Test page for saving page feature.htm");
+ FilePath dir = download_dir_.AppendASCII(
+ "Test page for saving page feature_files");
+
+ GURL url = URLRequestMockHTTPJob::GetMockUrl(UTF8ToWide(kTestDir + "/" +
+ file_name));
scoped_ptr<TabProxy> tab(GetActiveTab());
ASSERT_TRUE(tab->NavigateToURL(url));
WaitUntilTabCount(1);
@@ -139,19 +148,23 @@ TEST_F(SavePageTest, FilenameFromPageTitle) {
EXPECT_TRUE(WaitForDownloadShelfVisible(tab.get()));
automation()->SavePackageShouldPromptUser(true);
- CheckFile(dir + L"\\1.png", L"1.png", true);
- CheckFile(dir + L"\\1.css", L"1.css", true);
- CheckFile(full_file_name, file_name, false);
+ CheckFile(dir.AppendASCII("1.png"), FilePath(FILE_PATH_LITERAL("1.png")),
+ true);
+ CheckFile(dir.AppendASCII("1.css"), FilePath(FILE_PATH_LITERAL("1.css")),
+ true);
+ CheckFile(full_file_name, FilePath::FromWStringHack(UTF8ToWide(file_name)),
+ false);
EXPECT_TRUE(DieFileDie(full_file_name, false));
EXPECT_TRUE(DieFileDie(dir, true));
}
TEST_F(SavePageTest, CleanFilenameFromPageTitle) {
- std::wstring file_name = L"c.htm";
- std::wstring full_file_name = download_dir_ + L"test.htm";
- std::wstring dir = download_dir_ + L"test_files";
+ std::string file_name = "c.htm";
+ FilePath full_file_name = download_dir_.AppendASCII("test.htm");
+ FilePath dir = download_dir_.AppendASCII("test_files");
- GURL url = URLRequestMockHTTPJob::GetMockUrl(kTestDir + L"/" + file_name);
+ GURL url = URLRequestMockHTTPJob::GetMockUrl(UTF8ToWide(kTestDir + "/" +
+ file_name));
scoped_ptr<TabProxy> tab(GetActiveTab());
ASSERT_TRUE(tab->NavigateToURL(url));
WaitUntilTabCount(1);
@@ -162,7 +175,8 @@ TEST_F(SavePageTest, CleanFilenameFromPageTitle) {
EXPECT_TRUE(WaitForDownloadShelfVisible(tab.get()));
automation()->SavePackageShouldPromptUser(true);
- CheckFile(full_file_name, file_name, false);
+ CheckFile(full_file_name, FilePath::FromWStringHack(UTF8ToWide(file_name)),
+ false);
EXPECT_TRUE(DieFileDie(full_file_name, false));
EXPECT_TRUE(DieFileDie(dir, true));
}
diff --git a/chrome/browser/sessions/session_restore_uitest.cc b/chrome/browser/sessions/session_restore_uitest.cc
index 58bee39..4c4538f 100644
--- a/chrome/browser/sessions/session_restore_uitest.cc
+++ b/chrome/browser/sessions/session_restore_uitest.cc
@@ -311,7 +311,7 @@ TEST_F(SessionRestoreUITest, DISABLED_TwoWindowsCloseOneRestoreOnlyOne) {
initial_window_count == 1);
// Open a second window.
- ASSERT_TRUE(automation()->OpenNewBrowserWindow(SW_SHOWNORMAL));
+ ASSERT_TRUE(automation()->OpenNewBrowserWindow(true));
ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, action_timeout_ms()));
// Close it.
diff --git a/chrome/browser/tab_restore_uitest.cc b/chrome/browser/tab_restore_uitest.cc
index b72e6dc..6a16c9b 100644
--- a/chrome/browser/tab_restore_uitest.cc
+++ b/chrome/browser/tab_restore_uitest.cc
@@ -103,7 +103,7 @@ TEST_F(TabRestoreUITest, RestoreToDifferentWindow) {
tab_proxy->NavigateToURL(url2_);
// Create a new browser.
- ASSERT_TRUE(automation()->OpenNewBrowserWindow(SW_HIDE));
+ ASSERT_TRUE(automation()->OpenNewBrowserWindow(false));
ASSERT_TRUE(automation()->WaitForWindowCountToBecome(
2, action_max_timeout_ms()));
@@ -225,7 +225,7 @@ TEST_F(TabRestoreUITest, RestoreWindow) {
// Create a new window.
int window_count;
ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count));
- ASSERT_TRUE(automation()->OpenNewBrowserWindow(SW_HIDE));
+ ASSERT_TRUE(automation()->OpenNewBrowserWindow(false));
ASSERT_TRUE(automation()->WaitForWindowCountToBecome(
++window_count, action_max_timeout_ms()));
diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc
index a42cc96..5878197 100644
--- a/chrome/common/temp_scaffolding_stubs.cc
+++ b/chrome/common/temp_scaffolding_stubs.cc
@@ -44,10 +44,6 @@ void AutomationProvider::GetFocusedViewID(int handle, int* view_id) {
NOTIMPLEMENTED();
}
-void AutomationProvider::OpenNewBrowserWindow(int show_command) {
- NOTIMPLEMENTED();
-}
-
void AutomationProvider::GetAutocompleteEditForBrowser(
int browser_handle,
bool* success,
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h
index 59599b1..b954b3f 100644
--- a/chrome/test/automation/automation_messages_internal.h
+++ b/chrome/test/automation/automation_messages_internal.h
@@ -360,7 +360,7 @@ IPC_BEGIN_MESSAGES(Automation)
// Opens a new browser window.
IPC_SYNC_MESSAGE_ROUTED1_0(AutomationMsg_OpenNewBrowserWindow,
- int /* show_command*/ )
+ bool /* show */ )
// This message requests the handle (int64 app-unique identifier) of the
// current active top window. On error, the returned handle value is 0.
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc
index 3a8f406..416d0c9 100644
--- a/chrome/test/automation/automation_proxy.cc
+++ b/chrome/test/automation/automation_proxy.cc
@@ -466,8 +466,8 @@ void AutomationProxy::InvalidateHandle(const IPC::Message& message) {
}
}
-bool AutomationProxy::OpenNewBrowserWindow(int show_command) {
- return Send(new AutomationMsg_OpenNewBrowserWindow(0, show_command));
+bool AutomationProxy::OpenNewBrowserWindow(bool show) {
+ return Send(new AutomationMsg_OpenNewBrowserWindow(0, show));
}
#if defined(OS_WIN)
diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h
index 138edd0..46a3b23 100644
--- a/chrome/test/automation/automation_proxy.h
+++ b/chrome/test/automation/automation_proxy.h
@@ -80,10 +80,10 @@ class AutomationProxy : public IPC::Channel::Listener,
// Returns true if the load is successful.
bool WaitForInitialNewTabUILoad(int* load_time);
- // Open a new browser window, returning true on success. |show_command|
- // identifies how the window should be shown.
+ // Open a new browser window, returning true on success. |show|
+ // identifies whether the window should be shown.
// False likely indicates an IPC error.
- bool OpenNewBrowserWindow(int show_command);
+ bool OpenNewBrowserWindow(bool show);
// Fills the number of open browser windows into the given variable, returning
// true on success. False likely indicates an IPC error.