summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-23 14:35:35 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-23 14:35:35 +0000
commite28c2cf908cf2e232329ce9431b68a4b8e4287a6 (patch)
tree53f67285c1a7e3c744803d51ece6d666e44c539a /chrome/browser
parenta9329fff10db68e6612fb804ec906b5cc2f418fd (diff)
downloadchromium_src-e28c2cf908cf2e232329ce9431b68a4b8e4287a6.zip
chromium_src-e28c2cf908cf2e232329ce9431b68a4b8e4287a6.tar.gz
chromium_src-e28c2cf908cf2e232329ce9431b68a4b8e4287a6.tar.bz2
Port more UI tests to Linux.
- enable following ui tests on Linux: history_uitest.cc inspector_controller_uitest.cc browser/history/redirect_uitest.cc browser/locale_tests_uitest.cc browser/sanity_uitest.cc - move information about Linux-specific splash page to more generic location and enable more logic about start page on Linux - maintainability cleanups (DISABLED_ instead of #if 0) - misc GCC-related cleanups Review URL: http://codereview.chromium.org/49006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12281 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/browser.cc3
-rw-r--r--chrome/browser/history/redirect_uitest.cc30
-rw-r--r--chrome/browser/iframe_uitest.cc6
-rw-r--r--chrome/browser/sanity_uitest.cc1
-rw-r--r--chrome/browser/session_history_uitest.cc78
5 files changed, 54 insertions, 64 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index b2d7f7b..8c7ed5a 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -2448,9 +2448,6 @@ void Browser::BuildPopupWindow(TabContents* source,
}
GURL Browser::GetHomePage() {
-#if defined(OS_LINUX)
- return GURL("about:linux-splash");
-#endif
if (profile_->GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage))
return GURL(chrome::kChromeUINewTabURL);
GURL home_page = GURL(URLFixerUpper::FixupURL(
diff --git a/chrome/browser/history/redirect_uitest.cc b/chrome/browser/history/redirect_uitest.cc
index 9bc8276..af80496 100644
--- a/chrome/browser/history/redirect_uitest.cc
+++ b/chrome/browser/history/redirect_uitest.cc
@@ -7,10 +7,10 @@
// 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_util.h"
+#include "base/platform_thread.h"
#include "base/scoped_ptr.h"
#include "base/string_util.h"
-// TODO(creis): Remove win_util when finished debugging ClientServerServer.
-#include "base/win_util.h"
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/ui/ui_test.h"
#include "net/base/net_util.h"
@@ -46,7 +46,7 @@ TEST_F(RedirectTest, Server) {
std::vector<GURL> redirects;
ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects));
- ASSERT_EQ(1, redirects.size());
+ ASSERT_EQ(1U, redirects.size());
EXPECT_EQ(final_url.spec(), redirects[0].spec());
}
@@ -63,7 +63,7 @@ TEST_F(RedirectTest, Client) {
// We need the sleep for the client redirects, because it appears as two
// page visits in the browser.
NavigateToURL(first_url);
- Sleep(action_timeout_ms());
+ PlatformThread::Sleep(action_timeout_ms());
scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
@@ -71,7 +71,7 @@ TEST_F(RedirectTest, Client) {
std::vector<GURL> redirects;
ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects));
- ASSERT_EQ(1, redirects.size());
+ ASSERT_EQ(1U, redirects.size());
EXPECT_EQ(final_url.spec(), redirects[0].spec());
}
@@ -92,7 +92,7 @@ TEST_F(RedirectTest, ClientEmptyReferer) {
// loads the html file on disk, rather than just getting a response from
// the TestServer.
for (int i = 0; i < 10; ++i) {
- Sleep(sleep_timeout_ms());
+ PlatformThread::Sleep(sleep_timeout_ms());
scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects));
@@ -100,7 +100,7 @@ TEST_F(RedirectTest, ClientEmptyReferer) {
break;
}
- EXPECT_EQ(1, redirects.size());
+ EXPECT_EQ(1U, redirects.size());
EXPECT_EQ(final_url.spec(), redirects[0].spec());
}
@@ -109,10 +109,11 @@ TEST_F(RedirectTest, ClientEmptyReferer) {
TEST_F(RedirectTest, ClientCancelled) {
std::wstring first_path = test_data_directory_;
file_util::AppendToPath(&first_path, L"cancelled_redirect_test.html");
+ ASSERT_TRUE(file_util::AbsolutePath(&first_path));
GURL first_url = net::FilePathToFileURL(first_path);
NavigateToURL(first_url);
- Sleep(action_timeout_ms());
+ PlatformThread::Sleep(action_timeout_ms());
scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
@@ -123,7 +124,7 @@ TEST_F(RedirectTest, ClientCancelled) {
// There should be no redirects from first_url, because the anchor location
// change that occurs should not be flagged as a redirect and the meta-refresh
// won't have fired yet.
- ASSERT_EQ(0, redirects.size());
+ ASSERT_EQ(0U, redirects.size());
GURL current_url;
ASSERT_TRUE(tab_proxy->GetCurrentURL(&current_url));
@@ -133,6 +134,7 @@ TEST_F(RedirectTest, ClientCancelled) {
std::string final_ref = "myanchor";
std::wstring 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(final_ref, current_url.ref());
@@ -160,7 +162,7 @@ TEST_F(RedirectTest, DISABLED_ClientServerServer) {
NavigateToURL(first_url);
for (int i = 0; i < 10; ++i) {
- Sleep(sleep_timeout_ms());
+ PlatformThread::Sleep(sleep_timeout_ms());
scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects));
@@ -168,7 +170,7 @@ TEST_F(RedirectTest, DISABLED_ClientServerServer) {
break;
}
- ASSERT_EQ(3, redirects.size());
+ ASSERT_EQ(3U, redirects.size());
EXPECT_EQ(second_url.spec(), redirects[0].spec());
EXPECT_EQ(next_to_last.spec(), redirects[1].spec());
EXPECT_EQ(final_url.spec(), redirects[2].spec());
@@ -231,7 +233,7 @@ TEST_F(RedirectTest, ClientFragments) {
NavigateToURL(first_url);
for (int i = 0; i < 10; ++i) {
- Sleep(sleep_timeout_ms());
+ PlatformThread::Sleep(sleep_timeout_ms());
scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects));
@@ -239,7 +241,7 @@ TEST_F(RedirectTest, ClientFragments) {
break;
}
- EXPECT_EQ(1, redirects.size());
+ EXPECT_EQ(1U, redirects.size());
EXPECT_EQ(first_url.spec() + "#myanchor", redirects[0].spec());
}
@@ -279,7 +281,7 @@ TEST_F(RedirectTest,
std::wstring final_url_title = L"Title Of Awesomeness";
// Wait till the final page has been loaded.
for (int i = 0; i < 10; ++i) {
- Sleep(sleep_timeout_ms());
+ PlatformThread::Sleep(sleep_timeout_ms());
scoped_ptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
ASSERT_TRUE(tab_proxy->GetTabTitle(&tab_title));
diff --git a/chrome/browser/iframe_uitest.cc b/chrome/browser/iframe_uitest.cc
index 6cd75b0..7e2e617 100644
--- a/chrome/browser/iframe_uitest.cc
+++ b/chrome/browser/iframe_uitest.cc
@@ -4,6 +4,7 @@
#include "base/basictypes.h"
#include "base/file_util.h"
+#include "base/platform_thread.h"
#include "chrome/test/ui/ui_test.h"
#include "net/base/net_util.h"
@@ -14,7 +15,8 @@ class IFrameTest : public UITest {
file_util::AppendToPath(&test_file, url);
NavigateToURL(net::FilePathToFileURL(test_file));
- Sleep(sleep_timeout_ms()); // The browser lazily updates the title.
+ // The browser lazily updates the title.
+ PlatformThread::Sleep(sleep_timeout_ms());
// Make sure the navigation succeeded.
EXPECT_EQ(std::wstring(page_title), GetActiveTabTitle());
@@ -28,8 +30,6 @@ TEST_F(IFrameTest, Crash) {
NavigateAndVerifyTitle(L"iframe.html", L"iframe test");
}
-// http://crbug.com/3035 : Triggers a DCHECK in web_contents.cc. Need to
-// investigate.
TEST_F(IFrameTest, InEmptyFrame) {
NavigateAndVerifyTitle(L"iframe_in_empty_frame.html", L"iframe test");
}
diff --git a/chrome/browser/sanity_uitest.cc b/chrome/browser/sanity_uitest.cc
index 5559ca4..77cc14d 100644
--- a/chrome/browser/sanity_uitest.cc
+++ b/chrome/browser/sanity_uitest.cc
@@ -9,6 +9,7 @@
#include "base/basictypes.h"
#include "base/file_util.h"
+#include "base/platform_thread.h"
class GoogleTest : public UITest {
protected:
diff --git a/chrome/browser/session_history_uitest.cc b/chrome/browser/session_history_uitest.cc
index 64edd93..a74d8e4 100644
--- a/chrome/browser/session_history_uitest.cc
+++ b/chrome/browser/session_history_uitest.cc
@@ -3,7 +3,8 @@
// found in the LICENSE file.
#include "base/file_util.h"
-#include "base/win_util.h"
+#include "base/platform_thread.h"
+#include "base/string_util.h"
#include "chrome/common/l10n_util.h"
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/automation/browser_proxy.h"
@@ -22,8 +23,7 @@ class SessionHistoryTest : public UITest {
protected:
SessionHistoryTest() : UITest() {
FilePath path = FilePath::FromWStringHack(test_data_directory_);
- path = path.AppendASCII("session_history")
- .Append(FilePath::StringType(&FilePath::kSeparators[0], 1));
+ path = path.AppendASCII("session_history");
url_prefix_ = UTF8ToWide(net::FilePathToFileURL(path).spec());
}
@@ -41,16 +41,15 @@ class SessionHistoryTest : public UITest {
}
// Simulate clicking a link. Only works on the frames.html testserver page.
- void ClickLink(std::wstring node_id) {
- GURL url(L"javascript:clickLink('" + node_id + L"')");
+ void ClickLink(std::string node_id) {
+ GURL url("javascript:clickLink('" + node_id + "')");
ASSERT_TRUE(tab_->NavigateToURL(url));
}
// Simulate filling in form data. Only works on the frames.html page with
// subframe = form.html, and on form.html itself.
- void FillForm(std::wstring node_id, std::wstring value) {
- GURL url(L"javascript:fillForm('" + node_id +
- L"', '" + value + L"')");
+ void FillForm(std::string node_id, std::string value) {
+ GURL url("javascript:fillForm('" + node_id + "', '" + value + "')");
// This will return immediately, but since the JS executes synchronously
// on the renderer, it will complete before the next navigate message is
// processed.
@@ -59,8 +58,8 @@ class SessionHistoryTest : public UITest {
// Simulate submitting a form. Only works on the frames.html page with
// subframe = form.html, and on form.html itself.
- void SubmitForm(std::wstring node_id) {
- GURL url(L"javascript:submitForm('" + node_id + L"')");
+ void SubmitForm(std::string node_id) {
+ GURL url("javascript:submitForm('" + node_id + "')");
ASSERT_TRUE(tab_->NavigateToURL(url));
}
@@ -81,12 +80,12 @@ class SessionHistoryTest : public UITest {
// Error pages load separately, but the UI automation system does not wait
// for error pages to load before returning after a navigation request.
// So, we need to sleep a little.
- DWORD kWaitForErrorPageMsec = 200;
+ const int kWaitForErrorPageMsec = 200;
for (int i = 0; i < 10; ++i) {
if (value.compare(GetTabTitle()) == 0)
return value;
- Sleep(kWaitForErrorPageMsec);
+ PlatformThread::Sleep(kWaitForErrorPageMsec);
}
return GetTabTitle();
}
@@ -167,17 +166,12 @@ TEST_F(SessionHistoryTest, BasicBackForward) {
// Test that back/forward works when navigating in subframes.
TEST_F(SessionHistoryTest, FrameBackForward) {
- // Bug: http://b/1175763, skip this test on Windows 2000 until
- // flakiness is investigated and fixed.
- if (win_util::GetWinVersion() <= win_util::WINVERSION_2000)
- return;
-
scoped_refptr<HTTPTestServer> server =
HTTPTestServer::CreateServer(kDocRoot, NULL);
ASSERT_TRUE(NULL != server.get());
// about:blank should be loaded first.
- GURL home(homepage_);
+ GURL home(WideToUTF8(homepage_));
ASSERT_FALSE(tab_->GoBack());
EXPECT_EQ(L"", GetTabTitle());
EXPECT_EQ(home, GetTabURL());
@@ -187,11 +181,11 @@ TEST_F(SessionHistoryTest, FrameBackForward) {
EXPECT_EQ(L"bot1", GetTabTitle());
EXPECT_EQ(frames, GetTabURL());
- ClickLink(L"abot2");
+ ClickLink("abot2");
EXPECT_EQ(L"bot2", GetTabTitle());
EXPECT_EQ(frames, GetTabURL());
- ClickLink(L"abot3");
+ ClickLink("abot3");
EXPECT_EQ(L"bot3", GetTabTitle());
EXPECT_EQ(frames, GetTabURL());
@@ -217,7 +211,7 @@ TEST_F(SessionHistoryTest, FrameBackForward) {
EXPECT_EQ(L"bot2", GetTabTitle());
EXPECT_EQ(frames, GetTabURL());
- ClickLink(L"abot1");
+ ClickLink("abot1");
EXPECT_EQ(L"bot1", GetTabTitle());
EXPECT_EQ(frames, GetTabURL());
@@ -250,11 +244,11 @@ TEST_F(SessionHistoryTest, FrameFormBackForward) {
ASSERT_TRUE(tab_->NavigateToURL(frames));
EXPECT_EQ(L"bot1", GetTabTitle());
- ClickLink(L"aform");
+ ClickLink("aform");
EXPECT_EQ(L"form", GetTabTitle());
EXPECT_EQ(frames, GetTabURL());
- SubmitForm(L"isubmit");
+ SubmitForm("isubmit");
EXPECT_EQ(L"text=&select=a", GetTabTitle());
EXPECT_EQ(frames, GetTabURL());
@@ -264,7 +258,7 @@ TEST_F(SessionHistoryTest, FrameFormBackForward) {
// history is [blank, bot1, *form, post]
- ClickLink(L"abot2");
+ ClickLink("abot2");
EXPECT_EQ(L"bot2", GetTabTitle());
EXPECT_EQ(frames, GetTabURL());
@@ -274,32 +268,31 @@ TEST_F(SessionHistoryTest, FrameFormBackForward) {
EXPECT_EQ(L"form", GetTabTitle());
EXPECT_EQ(frames, GetTabURL());
- SubmitForm(L"isubmit");
+ SubmitForm("isubmit");
EXPECT_EQ(L"text=&select=a", GetTabTitle());
EXPECT_EQ(frames, GetTabURL());
// history is [blank, bot1, form, *post]
-// TODO(mpcomplete): reenable this when WebKit bug 10199 is fixed:
-// "returning to a POST result within a frame does a GET instead of a POST"
-#if 0
- ClickLink(L"abot2");
- EXPECT_EQ(L"bot2", GetTabTitle());
- EXPECT_EQ(frames, GetTabURL());
+ if (false) {
+ // TODO(mpcomplete): reenable this when WebKit bug 10199 is fixed:
+ // "returning to a POST result within a frame does a GET instead of a POST"
+ ClickLink("abot2");
+ EXPECT_EQ(L"bot2", GetTabTitle());
+ EXPECT_EQ(frames, GetTabURL());
- ASSERT_TRUE(tab_->GoBack());
- EXPECT_EQ(L"text=&select=a", GetTabTitle());
- EXPECT_EQ(frames, GetTabURL());
-#endif
+ ASSERT_TRUE(tab_->GoBack());
+ EXPECT_EQ(L"text=&select=a", GetTabTitle());
+ EXPECT_EQ(frames, GetTabURL());
+ }
}
// TODO(mpcomplete): enable this when Bug 734372 is fixed:
// "Doing a session history navigation does not restore newly-created subframe
// document state"
-#if 0
// Test that back/forward preserves POST data and document state when navigating
// across frames (ie, from frame -> nonframe).
-TEST_F(SessionHistoryTest, CrossFrameFormBackForward) {
+TEST_F(SessionHistoryTest, DISABLED_CrossFrameFormBackForward) {
scoped_refptr<HTTPTestServer> server =
HTTPTestServer::CreateServer(kDocRoot, NULL);
ASSERT_TRUE(NULL != server.get());
@@ -312,11 +305,11 @@ TEST_F(SessionHistoryTest, CrossFrameFormBackForward) {
ASSERT_TRUE(tab_->NavigateToURL(frames));
EXPECT_EQ(L"bot1", GetTabTitle());
- ClickLink(L"aform");
+ ClickLink("aform");
EXPECT_EQ(L"form", GetTabTitle());
EXPECT_EQ(frames, GetTabURL());
- SubmitForm(L"isubmit");
+ SubmitForm("isubmit");
EXPECT_EQ(L"text=&select=a", GetTabTitle());
EXPECT_EQ(frames, GetTabURL());
@@ -338,11 +331,10 @@ TEST_F(SessionHistoryTest, CrossFrameFormBackForward) {
EXPECT_EQ(L"form", GetTabTitle());
EXPECT_EQ(frames, GetTabURL());
- SubmitForm(L"isubmit");
+ SubmitForm("isubmit");
EXPECT_EQ(L"text=&select=a", GetTabTitle());
EXPECT_EQ(frames, GetTabURL());
}
-#endif
// Test that back/forward entries are created for reference fragment
// navigations. Bug 730379.
@@ -499,8 +491,7 @@ TEST_F(SessionHistoryTest, JavascriptHistory) {
// This test is flaky and has been disabled. It looks like the server does not
// start fast enough, and the navigation fails (with 404). See bug 8444.
-#if 0
-TEST_F(SessionHistoryTest, LocationReplace) {
+TEST_F(SessionHistoryTest, DISABLED_LocationReplace) {
// Test that using location.replace doesn't leave the title of the old page
// visible.
scoped_refptr<HTTPTestServer> server =
@@ -511,4 +502,3 @@ TEST_F(SessionHistoryTest, LocationReplace) {
"files/session_history/replace.html?no-title.html")));
EXPECT_EQ(L"", GetTabTitle());
}
-#endif