| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/printing/print_dialog_cloud.h" | 5 #include "chrome/browser/printing/print_dialog_cloud.h" |
| 6 #include "chrome/browser/printing/print_dialog_cloud_internal.h" | 6 #include "chrome/browser/printing/print_dialog_cloud_internal.h" |
| 7 | 7 |
| 8 #include <functional> | 8 #include <functional> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 class SimpleTestJob : public net::URLRequestTestJob { | 71 class SimpleTestJob : public net::URLRequestTestJob { |
| 72 public: | 72 public: |
| 73 SimpleTestJob(net::URLRequest* request, | 73 SimpleTestJob(net::URLRequest* request, |
| 74 net::NetworkDelegate* network_delegate) | 74 net::NetworkDelegate* network_delegate) |
| 75 : net::URLRequestTestJob(request, | 75 : net::URLRequestTestJob(request, |
| 76 network_delegate, | 76 network_delegate, |
| 77 test_headers(), | 77 test_headers(), |
| 78 TestData::GetInstance()->GetTestData(), | 78 TestData::GetInstance()->GetTestData(), |
| 79 true) {} | 79 true) {} |
| 80 | 80 |
| 81 virtual void GetResponseInfo(net::HttpResponseInfo* info) { | 81 virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE { |
| 82 net::URLRequestTestJob::GetResponseInfo(info); | 82 net::URLRequestTestJob::GetResponseInfo(info); |
| 83 if (request_->url().SchemeIsSecure()) { | 83 if (request_->url().SchemeIsSecure()) { |
| 84 // Make up a fake certificate for this response since we don't have | 84 // Make up a fake certificate for this response since we don't have |
| 85 // access to the real SSL info. | 85 // access to the real SSL info. |
| 86 const char* kCertIssuer = "Chrome Internal"; | 86 const char* kCertIssuer = "Chrome Internal"; |
| 87 const int kLifetimeDays = 100; | 87 const int kLifetimeDays = 100; |
| 88 | 88 |
| 89 info->ssl_info.cert = | 89 info->ssl_info.cert = |
| 90 new net::X509Certificate(request_->url().GetWithEmptyPath().spec(), | 90 new net::X509Certificate(request_->url().GetWithEmptyPath().spec(), |
| 91 kCertIssuer, | 91 kCertIssuer, |
| 92 base::Time::Now(), | 92 base::Time::Now(), |
| 93 base::Time::Now() + | 93 base::Time::Now() + |
| 94 base::TimeDelta::FromDays(kLifetimeDays)); | 94 base::TimeDelta::FromDays(kLifetimeDays)); |
| 95 info->ssl_info.cert_status = 0; | 95 info->ssl_info.cert_status = 0; |
| 96 info->ssl_info.security_bits = -1; | 96 info->ssl_info.security_bits = -1; |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 ~SimpleTestJob() {} | 101 virtual ~SimpleTestJob() {} |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 class TestController { | 104 class TestController { |
| 105 public: | 105 public: |
| 106 static TestController* GetInstance() { | 106 static TestController* GetInstance() { |
| 107 return Singleton<TestController>::get(); | 107 return Singleton<TestController>::get(); |
| 108 } | 108 } |
| 109 void set_result(bool value) { | 109 void set_result(bool value) { |
| 110 result_ = value; | 110 result_ = value; |
| 111 } | 111 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_); | 152 PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_); |
| 153 } | 153 } |
| 154 | 154 |
| 155 // Must be static for handing into AddHostnameHandler. | 155 // Must be static for handing into AddHostnameHandler. |
| 156 static net::URLRequest::ProtocolFactory Factory; | 156 static net::URLRequest::ProtocolFactory Factory; |
| 157 | 157 |
| 158 class AutoQuitDelegate : public net::TestDelegate { | 158 class AutoQuitDelegate : public net::TestDelegate { |
| 159 public: | 159 public: |
| 160 AutoQuitDelegate() {} | 160 AutoQuitDelegate() {} |
| 161 | 161 |
| 162 virtual void OnResponseCompleted(net::URLRequest* request) { | 162 virtual void OnResponseCompleted(net::URLRequest* request) OVERRIDE { |
| 163 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 163 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 164 MessageLoop::QuitClosure()); | 164 MessageLoop::QuitClosure()); |
| 165 } | 165 } |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 virtual void SetUp() OVERRIDE { | 168 virtual void SetUp() OVERRIDE { |
| 169 TestController::GetInstance()->set_result(false); | 169 TestController::GetInstance()->set_result(false); |
| 170 InProcessBrowserTest::SetUp(); | 170 InProcessBrowserTest::SetUp(); |
| 171 } | 171 } |
| 172 | 172 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 BrowserWindow* window = browser()->window(); | 280 BrowserWindow* window = browser()->window(); |
| 281 ASSERT_TRUE(window); | 281 ASSERT_TRUE(window); |
| 282 gfx::NativeWindow native_window = window->GetNativeWindow(); | 282 gfx::NativeWindow native_window = window->GetNativeWindow(); |
| 283 ASSERT_TRUE(native_window); | 283 ASSERT_TRUE(native_window); |
| 284 bool key_sent = ui_controls::SendKeyPress(native_window, ui::VKEY_ESCAPE, | 284 bool key_sent = ui_controls::SendKeyPress(native_window, ui::VKEY_ESCAPE, |
| 285 false, false, false, false); | 285 false, false, false, false); |
| 286 EXPECT_TRUE(key_sent); | 286 EXPECT_TRUE(key_sent); |
| 287 if (key_sent) | 287 if (key_sent) |
| 288 tab_closed_observer.Wait(); | 288 tab_closed_observer.Wait(); |
| 289 } | 289 } |
| OLD | NEW |