| 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 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 22 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 23 #include "chrome/common/chrome_paths.h" | 23 #include "chrome/common/chrome_paths.h" |
| 24 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
| 25 #include "chrome/test/base/in_process_browser_test.h" | 25 #include "chrome/test/base/in_process_browser_test.h" |
| 26 #include "chrome/test/base/ui_test_utils.h" | 26 #include "chrome/test/base/ui_test_utils.h" |
| 27 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
| 28 #include "content/public/browser/notification_types.h" | 28 #include "content/public/browser/notification_types.h" |
| 29 #include "content/public/browser/render_view_host.h" | 29 #include "content/public/browser/render_view_host.h" |
| 30 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
| 31 #include "content/public/test/test_browser_thread.h" | 31 #include "content/public/test/test_browser_thread.h" |
| 32 #include "net/url_request/url_request.h" |
| 33 #include "net/url_request/url_request_context.h" |
| 32 #include "net/url_request/url_request_filter.h" | 34 #include "net/url_request/url_request_filter.h" |
| 33 #include "net/url_request/url_request_test_job.h" | 35 #include "net/url_request/url_request_test_job.h" |
| 34 #include "net/url_request/url_request_test_util.h" | 36 #include "net/url_request/url_request_test_util.h" |
| 35 #include "ui/ui_controls/ui_controls.h" | 37 #include "ui/ui_controls/ui_controls.h" |
| 36 | 38 |
| 37 using content::BrowserThread; | 39 using content::BrowserThread; |
| 38 | 40 |
| 39 namespace { | 41 namespace { |
| 40 | 42 |
| 41 class TestData { | 43 class TestData { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 64 std::string test_data_; | 66 std::string test_data_; |
| 65 | 67 |
| 66 friend struct DefaultSingletonTraits<TestData>; | 68 friend struct DefaultSingletonTraits<TestData>; |
| 67 }; | 69 }; |
| 68 | 70 |
| 69 // A simple test net::URLRequestJob. We don't care what it does, only that | 71 // A simple test net::URLRequestJob. We don't care what it does, only that |
| 70 // whether it starts and finishes. | 72 // whether it starts and finishes. |
| 71 class SimpleTestJob : public net::URLRequestTestJob { | 73 class SimpleTestJob : public net::URLRequestTestJob { |
| 72 public: | 74 public: |
| 73 explicit SimpleTestJob(net::URLRequest* request) | 75 explicit SimpleTestJob(net::URLRequest* request) |
| 74 : net::URLRequestTestJob(request, test_headers(), | 76 : net::URLRequestTestJob(request, |
| 75 TestData::GetInstance()->GetTestData(), true) {} | 77 request->context()->network_delegate(), |
| 78 test_headers(), |
| 79 TestData::GetInstance()->GetTestData(), |
| 80 true) {} |
| 76 | 81 |
| 77 virtual void GetResponseInfo(net::HttpResponseInfo* info) { | 82 virtual void GetResponseInfo(net::HttpResponseInfo* info) { |
| 78 net::URLRequestTestJob::GetResponseInfo(info); | 83 net::URLRequestTestJob::GetResponseInfo(info); |
| 79 if (request_->url().SchemeIsSecure()) { | 84 if (request_->url().SchemeIsSecure()) { |
| 80 // Make up a fake certificate for this response since we don't have | 85 // Make up a fake certificate for this response since we don't have |
| 81 // access to the real SSL info. | 86 // access to the real SSL info. |
| 82 const char* kCertIssuer = "Chrome Internal"; | 87 const char* kCertIssuer = "Chrome Internal"; |
| 83 const int kLifetimeDays = 100; | 88 const int kLifetimeDays = 100; |
| 84 | 89 |
| 85 info->ssl_info.cert = | 90 info->ssl_info.cert = |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 net::URLRequestJob* PrintDialogCloudTest::Factory(net::URLRequest* request, | 228 net::URLRequestJob* PrintDialogCloudTest::Factory(net::URLRequest* request, |
| 224 const std::string& scheme) { | 229 const std::string& scheme) { |
| 225 if (request && | 230 if (request && |
| 226 (request->url() == TestController::GetInstance()->expected_url())) { | 231 (request->url() == TestController::GetInstance()->expected_url())) { |
| 227 if (TestController::GetInstance()->use_delegate()) | 232 if (TestController::GetInstance()->use_delegate()) |
| 228 request->set_delegate(TestController::GetInstance()->delegate()); | 233 request->set_delegate(TestController::GetInstance()->delegate()); |
| 229 TestController::GetInstance()->set_result(true); | 234 TestController::GetInstance()->set_result(true); |
| 230 return new SimpleTestJob(request); | 235 return new SimpleTestJob(request); |
| 231 } | 236 } |
| 232 return new net::URLRequestTestJob(request, | 237 return new net::URLRequestTestJob(request, |
| 238 request->context()->network_delegate(), |
| 233 net::URLRequestTestJob::test_headers(), | 239 net::URLRequestTestJob::test_headers(), |
| 234 "", true); | 240 "", |
| 241 true); |
| 235 } | 242 } |
| 236 | 243 |
| 237 #if defined(OS_WIN) | 244 #if defined(OS_WIN) |
| 238 #define MAYBE_HandlersRegistered FLAKY_HandlersRegistered | 245 #define MAYBE_HandlersRegistered FLAKY_HandlersRegistered |
| 239 #else | 246 #else |
| 240 #define MAYBE_HandlersRegistered HandlersRegistered | 247 #define MAYBE_HandlersRegistered HandlersRegistered |
| 241 #endif | 248 #endif |
| 242 IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, MAYBE_HandlersRegistered) { | 249 IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, MAYBE_HandlersRegistered) { |
| 243 AddTestHandlers(); | 250 AddTestHandlers(); |
| 244 | 251 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 259 BrowserWindow* window = browser()->window(); | 266 BrowserWindow* window = browser()->window(); |
| 260 ASSERT_TRUE(window); | 267 ASSERT_TRUE(window); |
| 261 gfx::NativeWindow native_window = window->GetNativeWindow(); | 268 gfx::NativeWindow native_window = window->GetNativeWindow(); |
| 262 ASSERT_TRUE(native_window); | 269 ASSERT_TRUE(native_window); |
| 263 bool key_sent = ui_controls::SendKeyPress(native_window, ui::VKEY_ESCAPE, | 270 bool key_sent = ui_controls::SendKeyPress(native_window, ui::VKEY_ESCAPE, |
| 264 false, false, false, false); | 271 false, false, false, false); |
| 265 EXPECT_TRUE(key_sent); | 272 EXPECT_TRUE(key_sent); |
| 266 if (key_sent) | 273 if (key_sent) |
| 267 tab_closed_observer.Wait(); | 274 tab_closed_observer.Wait(); |
| 268 } | 275 } |
| OLD | NEW |