summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscottbyer@chromium.org <scottbyer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-11 21:18:49 +0000
committerscottbyer@chromium.org <scottbyer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-11 21:18:49 +0000
commit3da39d672ea484e983eaa1606e69749eee11b102 (patch)
treebbce78a0a427206cfe020de2ae9158f49ed7ef9a
parent64f12b64aee02fda94d0a45c6847749f35d0a3ad (diff)
downloadchromium_src-3da39d672ea484e983eaa1606e69749eee11b102.zip
chromium_src-3da39d672ea484e983eaa1606e69749eee11b102.tar.gz
chromium_src-3da39d672ea484e983eaa1606e69749eee11b102.tar.bz2
Revert 49592 - Fix crashy test.
http://code.google.com/p/chromium/issues/detail?id=44547 BUG=44547 TEST=PrintDialogCloudTest.HandlersRegistered TBR=scottbyer@chromium.org Review URL: http://codereview.chromium.org/2775007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49596 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/printing/print_dialog_cloud.cc2
-rw-r--r--chrome/browser/printing/print_dialog_cloud.h2
-rw-r--r--chrome/browser/printing/print_dialog_cloud_uitest.cc65
3 files changed, 21 insertions, 48 deletions
diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc
index 796a81d..5da3a2ff 100644
--- a/chrome/browser/printing/print_dialog_cloud.cc
+++ b/chrome/browser/printing/print_dialog_cloud.cc
@@ -104,7 +104,7 @@ void CloudPrintService::RegisterPreferences() {
if (pref_service->FindPreference(prefs::kCloudPrintServiceURL))
return;
std::wstring kDefaultCloudPrintServiceURL(
- L"https://www.google.com/cloudprint");
+ L"http://www.google.com/cloudprint");
pref_service->RegisterStringPref(prefs::kCloudPrintServiceURL,
kDefaultCloudPrintServiceURL);
}
diff --git a/chrome/browser/printing/print_dialog_cloud.h b/chrome/browser/printing/print_dialog_cloud.h
index a9736bd..175103a 100644
--- a/chrome/browser/printing/print_dialog_cloud.h
+++ b/chrome/browser/printing/print_dialog_cloud.h
@@ -20,7 +20,7 @@ class PrintDialogCloud {
static void CreatePrintDialogForPdf(const FilePath& path_to_pdf);
private:
- FRIEND_TEST(PrintDialogCloudTest, HandlersRegistered);
+ FRIEND_TEST_ALL_PREFIXES(PrintDialogCloudTest, HandlersRegistered);
explicit PrintDialogCloud(const FilePath& path_to_pdf);
~PrintDialogCloud();
diff --git a/chrome/browser/printing/print_dialog_cloud_uitest.cc b/chrome/browser/printing/print_dialog_cloud_uitest.cc
index ec8da96..469c060 100644
--- a/chrome/browser/printing/print_dialog_cloud_uitest.cc
+++ b/chrome/browser/printing/print_dialog_cloud_uitest.cc
@@ -50,26 +50,6 @@ class SimpleTestJob : public URLRequestTestJob {
explicit SimpleTestJob(URLRequest* request)
: URLRequestTestJob(request, test_headers(),
Singleton<TestData>()->GetTestData(), true) {}
-
- virtual void GetResponseInfo(net::HttpResponseInfo* info) {
- URLRequestTestJob::GetResponseInfo(info);
- if (request_->url().SchemeIsSecure()) {
- // Make up a fake certificate for this response since we don't have
- // access to the real SSL info.
- const char* kCertIssuer = "Chrome Internal";
- const int kLifetimeDays = 100;
-
- info->ssl_info.cert =
- new net::X509Certificate(request_->url().GetWithEmptyPath().spec(),
- kCertIssuer,
- base::Time::Now(),
- base::Time::Now() +
- base::TimeDelta::FromDays(kLifetimeDays));
- info->ssl_info.cert_status = 0;
- info->ssl_info.security_bits = 0;
- }
- }
-
private:
~SimpleTestJob() {}
};
@@ -89,21 +69,15 @@ class TestResult {
const GURL GetExpectedUrl() {
return expected_url_;
}
- void set_delegate(TestDelegate* delegate) {
- delegate_ = delegate;
- }
- TestDelegate* delegate() {
- return delegate_;
- }
private:
bool result_;
GURL expected_url_;
- TestDelegate* delegate_;
};
} // namespace
-class PrintDialogCloudTest : public InProcessBrowserTest {
+class PrintDialogCloudTest : public InProcessBrowserTest,
+ public NotificationObserver {
public:
PrintDialogCloudTest() : handler_added_(false) {
PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_);
@@ -112,16 +86,6 @@ class PrintDialogCloudTest : public InProcessBrowserTest {
// Must be static for handing into AddHostnameHandler.
static URLRequest::ProtocolFactory Factory;
- class PrintDialogCloudTestDelegate : public TestDelegate {
- public:
- PrintDialogCloudTestDelegate() {}
-
- virtual void OnResponseCompleted(URLRequest* request) {
- ChromeThread::PostTask(ChromeThread::UI, FROM_HERE,
- new MessageLoop::QuitTask());
- }
- };
-
virtual void SetUp() {
Singleton<TestResult>()->SetResult(false);
InProcessBrowserTest::SetUp();
@@ -132,7 +96,6 @@ class PrintDialogCloudTest : public InProcessBrowserTest {
URLRequestFilter* filter = URLRequestFilter::GetInstance();
filter->RemoveHostnameHandler(scheme_, host_name_);
handler_added_ = false;
- Singleton<TestResult>()->set_delegate(NULL);
}
InProcessBrowserTest::TearDown();
}
@@ -153,11 +116,23 @@ class PrintDialogCloudTest : public InProcessBrowserTest {
&PrintDialogCloudTest::Factory);
handler_added_ = true;
+ registrar_.Add(this, NotificationType::LOAD_STOP,
+ NotificationService::AllSources());
+
GURL cloud_print_dialog_url =
internal_cloud_print_helpers::CloudPrintService(browser()->profile()).
GetCloudPrintServiceDialogURL();
Singleton<TestResult>()->SetExpectedUrl(cloud_print_dialog_url);
- Singleton<TestResult>()->set_delegate(&delegate_);
+ }
+ }
+
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ if (type == NotificationType::LOAD_STOP) {
+ MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
+ registrar_.Remove(this, NotificationType::LOAD_STOP,
+ NotificationService::AllSources());
}
}
@@ -165,18 +140,18 @@ class PrintDialogCloudTest : public InProcessBrowserTest {
std::string scheme_;
std::string host_name_;
FilePath test_data_directory_;
- PrintDialogCloudTestDelegate delegate_;
+ NotificationRegistrar registrar_;
};
URLRequestJob* PrintDialogCloudTest::Factory(URLRequest* request,
const std::string& scheme) {
- request->set_delegate(Singleton<TestResult>()->delegate());
if (request && (request->url() == Singleton<TestResult>()->GetExpectedUrl()))
Singleton<TestResult>()->SetResult(true);
return new SimpleTestJob(request);
}
-IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, HandlersRegistered) {
+// Crashy, http://crbug.com/44547.
+IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, DISABLED_HandlersRegistered) {
BrowserList::SetLastActive(browser());
ASSERT_TRUE(BrowserList::GetLastActive());
@@ -184,11 +159,9 @@ IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, HandlersRegistered) {
FilePath pdf_file =
test_data_directory_.AppendASCII("printing/cloud_print_uitest.pdf");
+ new PrintDialogCloud(pdf_file);
- {
- PrintDialogCloud dialog (pdf_file);
ui_test_utils::RunMessageLoop();
- }
ASSERT_TRUE(Singleton<TestResult>()->GetResult());
}