summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 22:13:32 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 22:13:32 +0000
commit44bf8fbfa2786685070e90b6b12dac24da4b10d7 (patch)
treebb44e26037a64e3c06d80bb70da8f3eb4f2eee09 /content
parent224e861a69b6731ef51fdf978af22f51674cbdd8 (diff)
downloadchromium_src-44bf8fbfa2786685070e90b6b12dac24da4b10d7.zip
chromium_src-44bf8fbfa2786685070e90b6b12dac24da4b10d7.tar.gz
chromium_src-44bf8fbfa2786685070e90b6b12dac24da4b10d7.tar.bz2
ui_tests: use proper API for getting tab title
To get the title actually shown by a tab, call the function that we use for computing the tab text. (Sometimes it returns title() and sometimes it computes something more complex.) This is identical to r76841 but for a different testing framework. :\ BUG=this actually fixes the ancient Google-internal bug 634097(!) Review URL: http://codereview.chromium.org/6632006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76982 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/renderer_host/resource_dispatcher_host_uitest.cc44
1 files changed, 23 insertions, 21 deletions
diff --git a/content/browser/renderer_host/resource_dispatcher_host_uitest.cc b/content/browser/renderer_host/resource_dispatcher_host_uitest.cc
index 5271595..f20503b 100644
--- a/content/browser/renderer_host/resource_dispatcher_host_uitest.cc
+++ b/content/browser/renderer_host/resource_dispatcher_host_uitest.cc
@@ -23,13 +23,13 @@ namespace {
class ResourceDispatcherTest : public UITest {
public:
- void CheckTitleTest(const std::wstring& file,
- const std::wstring& expected_title,
+ void CheckTitleTest(const std::string& file,
+ const std::string& expected_title,
int expected_navigations) {
NavigateToURLBlockUntilNavigationsComplete(
- URLRequestMockHTTPJob::GetMockUrl(FilePath::FromWStringHack(file)),
+ URLRequestMockHTTPJob::GetMockUrl(FilePath().AppendASCII(file)),
expected_navigations);
- EXPECT_EQ(expected_title, GetActiveTabTitle());
+ EXPECT_EQ(expected_title, WideToASCII(GetActiveTabTitle()));
}
protected:
@@ -39,25 +39,27 @@ class ResourceDispatcherTest : public UITest {
};
TEST_F(ResourceDispatcherTest, SniffHTMLWithNoContentType) {
- CheckTitleTest(L"content-sniffer-test0.html",
- L"Content Sniffer Test 0", 1);
+ CheckTitleTest("content-sniffer-test0.html",
+ "Content Sniffer Test 0", 1);
}
TEST_F(ResourceDispatcherTest, RespectNoSniffDirective) {
- CheckTitleTest(L"nosniff-test.html", L"", 1);
+ CheckTitleTest("nosniff-test.html", "mock.http/nosniff-test.html", 1);
}
TEST_F(ResourceDispatcherTest, DoNotSniffHTMLFromTextPlain) {
- CheckTitleTest(L"content-sniffer-test1.html", L"", 1);
+ CheckTitleTest("content-sniffer-test1.html",
+ "mock.http/content-sniffer-test1.html", 1);
}
TEST_F(ResourceDispatcherTest, DoNotSniffHTMLFromImageGIF) {
- CheckTitleTest(L"content-sniffer-test2.html", L"", 1);
+ CheckTitleTest("content-sniffer-test2.html",
+ "mock.http/content-sniffer-test2.html", 1);
}
TEST_F(ResourceDispatcherTest, SniffNoContentTypeNoData) {
- CheckTitleTest(L"content-sniffer-test3.html",
- L"Content Sniffer Test 3", 1);
+ CheckTitleTest("content-sniffer-test3.html",
+ "Content Sniffer Test 3", 1);
EXPECT_EQ(1, GetTabCount());
// Make sure the download shelf is not showing.
@@ -69,11 +71,11 @@ TEST_F(ResourceDispatcherTest, SniffNoContentTypeNoData) {
}
TEST_F(ResourceDispatcherTest, ContentDispositionEmpty) {
- CheckTitleTest(L"content-disposition-empty.html", L"success", 1);
+ CheckTitleTest("content-disposition-empty.html", "success", 1);
}
TEST_F(ResourceDispatcherTest, ContentDispositionInline) {
- CheckTitleTest(L"content-disposition-inline.html", L"success", 1);
+ CheckTitleTest("content-disposition-inline.html", "success", 1);
}
// Test for bug #1091358.
@@ -181,8 +183,8 @@ TEST_F(ResourceDispatcherTest, CrossSiteOnunloadCookie) {
// Navigate to a new cross-site page, to dispatch unload event and set the
// cookie.
- CheckTitleTest(L"content-sniffer-test0.html",
- L"Content Sniffer Test 0", 1);
+ CheckTitleTest("content-sniffer-test0.html",
+ "Content Sniffer Test 0", 1);
// Check that the cookie was set.
std::string value_result;
@@ -220,8 +222,8 @@ TEST_F(ResourceDispatcherTest, CrossSiteAfterCrash) {
// Navigate to a new cross-site page. The browser should not wait around for
// the old renderer's on{before}unload handlers to run.
- CheckTitleTest(L"content-sniffer-test0.html",
- L"Content Sniffer Test 0", 1);
+ CheckTitleTest("content-sniffer-test0.html",
+ "Content Sniffer Test 0", 1);
}
#endif // !defined(OS_MACOSX)
@@ -234,8 +236,8 @@ TEST_F(ResourceDispatcherTest, CrossSiteNavigationNonBuffered) {
ASSERT_TRUE(tab.get());
// Start with an HTTP page.
- CheckTitleTest(L"content-sniffer-test0.html",
- L"Content Sniffer Test 0", 1);
+ CheckTitleTest("content-sniffer-test0.html",
+ "Content Sniffer Test 0", 1);
// 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.
@@ -305,8 +307,8 @@ TEST_F(ResourceDispatcherTest, CrossOriginRedirectBlocked) {
//
// If the redirect in #2 were not blocked, we'd also see a request
// for http://mock.http:4000/title2.html, and the title would be different.
- CheckTitleTest(L"cross-origin-redirect-blocked.html",
- L"Title Of More Awesomeness", 2);
+ CheckTitleTest("cross-origin-redirect-blocked.html",
+ "Title Of More Awesomeness", 2);
}
// Tests that ResourceDispatcherHostRequestInfo is updated correctly on failed