summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-27 16:42:20 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-27 16:42:20 +0000
commit2bd6ca1c42b1c5f3dfe1734a49c697adc22246f6 (patch)
treea7aba3f6a60e08bf29d2cc90e2d343f3530b812c /chrome/browser
parentd1fda80b9254869bab3ca816c135088c9724970e (diff)
downloadchromium_src-2bd6ca1c42b1c5f3dfe1734a49c697adc22246f6.zip
chromium_src-2bd6ca1c42b1c5f3dfe1734a49c697adc22246f6.tar.gz
chromium_src-2bd6ca1c42b1c5f3dfe1734a49c697adc22246f6.tar.bz2
Revert r24606-24607. The tree didn't like them. :(
TBR=darin Review URL: http://codereview.chromium.org/173574 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24608 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/errorpage_uitest.cc41
-rw-r--r--chrome/browser/google_util.cc3
-rw-r--r--chrome/browser/google_util.h2
-rw-r--r--chrome/browser/net/url_request_mock_link_doctor_job.cc40
-rw-r--r--chrome/browser/net/url_request_mock_link_doctor_job.h23
-rw-r--r--chrome/browser/net/url_request_mock_util.cc2
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc6
7 files changed, 29 insertions, 88 deletions
diff --git a/chrome/browser/errorpage_uitest.cc b/chrome/browser/errorpage_uitest.cc
index f6e54fb..3e34822 100644
--- a/chrome/browser/errorpage_uitest.cc
+++ b/chrome/browser/errorpage_uitest.cc
@@ -19,6 +19,15 @@ class ErrorPageTest : public UITest {
}
return false;
}
+ bool WaitForTitleContaining(const std::string& title_substring) {
+ for (int i = 0; i < 100; ++i) {
+ std::wstring title = GetActiveTabTitle();
+ if (title.find(UTF8ToWide(title_substring)) != std::wstring::npos)
+ return true;
+ PlatformThread::Sleep(sleep_timeout_ms() / 10);
+ }
+ return false;
+ }
};
TEST_F(ErrorPageTest, DNSError_Basic) {
@@ -28,7 +37,7 @@ TEST_F(ErrorPageTest, DNSError_Basic) {
// page.
NavigateToURLBlockUntilNavigationsComplete(test_url, 2);
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ EXPECT_TRUE(WaitForTitleContaining(test_url.host()));
}
TEST_F(ErrorPageTest, DNSError_GoBack1) {
@@ -37,8 +46,8 @@ TEST_F(ErrorPageTest, DNSError_GoBack1) {
GURL test_url(URLRequestFailedDnsJob::kTestUrl);
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title2.html"));
- NavigateToURLBlockUntilNavigationsComplete(test_url, 2);
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ NavigateToURL(test_url);
+ EXPECT_TRUE(WaitForTitleContaining(test_url.host()));
GetActiveTab()->GoBack();
@@ -51,14 +60,14 @@ TEST_F(ErrorPageTest, DNSError_GoBack2) {
GURL test_url(URLRequestFailedDnsJob::kTestUrl);
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title2.html"));
- NavigateToURLBlockUntilNavigationsComplete(test_url, 2);
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ NavigateToURL(test_url);
+ EXPECT_TRUE(WaitForTitleContaining(test_url.host()));
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title3.html"));
// The first navigation should fail, and the second one should be the error
// page.
GetActiveTab()->GoBackBlockUntilNavigationsComplete(2);
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ EXPECT_TRUE(WaitForTitleContaining(test_url.host()));
GetActiveTab()->GoBack();
EXPECT_TRUE(WaitForTitleMatching(L"Title Of Awesomeness"));
@@ -71,20 +80,20 @@ TEST_F(ErrorPageTest, DNSError_GoBack2AndForward) {
GURL test_url(URLRequestFailedDnsJob::kTestUrl);
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title2.html"));
- NavigateToURLBlockUntilNavigationsComplete(test_url, 2);
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ NavigateToURL(test_url);
+ EXPECT_TRUE(WaitForTitleContaining(test_url.host()));
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title3.html"));
// The first navigation should fail, and the second one should be the error
// page.
GetActiveTab()->GoBackBlockUntilNavigationsComplete(2);
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ EXPECT_TRUE(WaitForTitleContaining(test_url.host()));
GetActiveTab()->GoBack();
// The first navigation should fail, and the second one should be the error
// page.
GetActiveTab()->GoForwardBlockUntilNavigationsComplete(2);
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ EXPECT_TRUE(WaitForTitleContaining(test_url.host()));
}
TEST_F(ErrorPageTest, DNSError_GoBack2Forward2) {
@@ -94,19 +103,19 @@ TEST_F(ErrorPageTest, DNSError_GoBack2Forward2) {
GURL test_url(URLRequestFailedDnsJob::kTestUrl);
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title3.html"));
- NavigateToURLBlockUntilNavigationsComplete(test_url, 2);
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ NavigateToURL(test_url);
+ EXPECT_TRUE(WaitForTitleContaining(test_url.host()));
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title2.html"));
// The first navigation should fail, and the second one should be the error
// page.
GetActiveTab()->GoBackBlockUntilNavigationsComplete(2);
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ EXPECT_TRUE(WaitForTitleContaining(test_url.host()));
GetActiveTab()->GoBack();
// The first navigation should fail, and the second one should be the error
// page.
GetActiveTab()->GoForwardBlockUntilNavigationsComplete(2);
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ EXPECT_TRUE(WaitForTitleContaining(test_url.host()));
GetActiveTab()->GoForward();
EXPECT_TRUE(WaitForTitleMatching(L"Title Of Awesomeness"));
@@ -166,13 +175,13 @@ TEST_F(ErrorPageTest, Page404) {
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title2.html"));
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"page404.html"));
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ EXPECT_TRUE(WaitForTitleContaining("page404.html"));
}
TEST_F(ErrorPageTest, Page404_GoBack) {
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"title2.html"));
NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(L"page404.html"));
- EXPECT_TRUE(WaitForTitleMatching(L"Mock Link Doctor"));
+ EXPECT_TRUE(WaitForTitleContaining("page404.html"));
GetActiveTab()->GoBack();
diff --git a/chrome/browser/google_util.cc b/chrome/browser/google_util.cc
index 9cb5e22..0949d2f 100644
--- a/chrome/browser/google_util.cc
+++ b/chrome/browser/google_util.cc
@@ -31,9 +31,6 @@ GURL AppendParam(const GURL& url,
namespace google_util {
-const char kLinkDoctorBaseURL[] =
- "http://linkhelp.clients.google.com/tbproxy/lh/fixurl";
-
GURL AppendGoogleLocaleParam(const GURL& url) {
return AppendParam(url, "hl",
g_browser_process->GetApplicationLocale());
diff --git a/chrome/browser/google_util.h b/chrome/browser/google_util.h
index a4f99e3..d24ae89 100644
--- a/chrome/browser/google_util.h
+++ b/chrome/browser/google_util.h
@@ -11,8 +11,6 @@ class GURL;
namespace google_util {
-extern const char kLinkDoctorBaseURL[];
-
// Adds the Google locale string to the URL (e.g., hl=en-US). This does not
// check to see if the param already exists.
GURL AppendGoogleLocaleParam(const GURL& url);
diff --git a/chrome/browser/net/url_request_mock_link_doctor_job.cc b/chrome/browser/net/url_request_mock_link_doctor_job.cc
deleted file mode 100644
index 88ef438..0000000
--- a/chrome/browser/net/url_request_mock_link_doctor_job.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/net/url_request_mock_link_doctor_job.h"
-
-#include "base/path_service.h"
-#include "chrome/browser/google_util.h"
-#include "chrome/common/chrome_paths.h"
-#include "googleurl/src/gurl.h"
-#include "net/url_request/url_request_filter.h"
-
-namespace {
-
-FilePath GetMockFilePath() {
- FilePath test_dir;
- bool success = PathService::Get(chrome::DIR_TEST_DATA, &test_dir);
- DCHECK(success);
- return test_dir.AppendASCII("mock-link-doctor.html");
-}
-
-} // namespace
-
-/* static */
-URLRequestJob* URLRequestMockLinkDoctorJob::Factory(URLRequest* request,
- const std::string& scheme) {
- return new URLRequestMockLinkDoctorJob(request);
-}
-
-/* static */
-void URLRequestMockLinkDoctorJob::AddUrlHandler() {
- URLRequestFilter* filter = URLRequestFilter::GetInstance();
- filter->AddHostnameHandler("http",
- GURL(google_util::kLinkDoctorBaseURL).host(),
- URLRequestMockLinkDoctorJob::Factory);
-}
-
-URLRequestMockLinkDoctorJob::URLRequestMockLinkDoctorJob(URLRequest* request)
- : URLRequestMockHTTPJob(request, GetMockFilePath()) {
-}
diff --git a/chrome/browser/net/url_request_mock_link_doctor_job.h b/chrome/browser/net/url_request_mock_link_doctor_job.h
deleted file mode 100644
index 74fd00e..0000000
--- a/chrome/browser/net/url_request_mock_link_doctor_job.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// A URLRequestJob class that substitutes LinkDoctor requests.
-
-#ifndef CHROME_BROWSER_NET_URL_REQUEST_MOCK_LINK_DOCTOR_JOB_H_
-#define CHROME_BROWSER_NET_URL_REQUEST_MOCK_LINK_DOCTOR_JOB_H_
-
-#include "chrome/browser/net/url_request_mock_http_job.h"
-
-class URLRequestMockLinkDoctorJob : public URLRequestMockHTTPJob {
- public:
- URLRequestMockLinkDoctorJob(URLRequest* request);
- virtual ~URLRequestMockLinkDoctorJob() { }
-
- static URLRequest::ProtocolFactory Factory;
-
- // Adds the testing URLs to the URLRequestFilter.
- static void AddUrlHandler();
-};
-
-# endif // CHROME_BROWSER_NET_URL_REQUEST_MOCK_LINK_DOCTOR_JOB_H_
diff --git a/chrome/browser/net/url_request_mock_util.cc b/chrome/browser/net/url_request_mock_util.cc
index 680ed1d..9a559b1 100644
--- a/chrome/browser/net/url_request_mock_util.cc
+++ b/chrome/browser/net/url_request_mock_util.cc
@@ -10,7 +10,6 @@
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/net/url_request_failed_dns_job.h"
#include "chrome/browser/net/url_request_mock_http_job.h"
-#include "chrome/browser/net/url_request_mock_link_doctor_job.h"
#include "chrome/browser/net/url_request_slow_download_job.h"
#include "chrome/browser/net/url_request_slow_http_job.h"
#include "chrome/common/chrome_paths.h"
@@ -27,7 +26,6 @@ void SetUrlRequestMocksEnabled(bool enabled) {
URLRequestFilter::GetInstance()->ClearHandlers();
URLRequestFailedDnsJob::AddUrlHandler();
- URLRequestMockLinkDoctorJob::AddUrlHandler();
URLRequestSlowDownloadJob::AddUrlHandler();
std::wstring root_http;
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 8767bc9..3eeacde 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -132,6 +132,9 @@ const float kMaxHeightFactor = 0.6;
// contents.
const int kJavascriptMessageExpectedDelay = 1000;
+const char kLinkDoctorBaseURL[] =
+ "http://linkhelp.clients.google.com/tbproxy/lh/fixurl";
+
// The list of prefs we want to observe.
const wchar_t* kPrefsToObserve[] = {
prefs::kAlternateErrorPagesEnabled,
@@ -2252,8 +2255,7 @@ GURL TabContents::GetAlternateErrorPageURL() const {
PrefService* prefs = profile()->GetPrefs();
DCHECK(prefs);
if (prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)) {
- url = google_util::AppendGoogleLocaleParam(
- GURL(google_util::kLinkDoctorBaseURL));
+ url = google_util::AppendGoogleLocaleParam(GURL(kLinkDoctorBaseURL));
url = google_util::AppendGoogleTLDParam(url);
}
return url;