| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 return test_data_.c_str(); | 50 return test_data_.c_str(); |
| 51 } | 51 } |
| 52 private: | 52 private: |
| 53 TestData() {} | 53 TestData() {} |
| 54 | 54 |
| 55 std::string test_data_; | 55 std::string test_data_; |
| 56 | 56 |
| 57 friend struct DefaultSingletonTraits<TestData>; | 57 friend struct DefaultSingletonTraits<TestData>; |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 // A simple test URLRequestJob. We don't care what it does, only that | 60 // A simple test net::URLRequestJob. We don't care what it does, only that |
| 61 // whether it starts and finishes. | 61 // whether it starts and finishes. |
| 62 class SimpleTestJob : public URLRequestTestJob { | 62 class SimpleTestJob : public URLRequestTestJob { |
| 63 public: | 63 public: |
| 64 explicit SimpleTestJob(net::URLRequest* request) | 64 explicit SimpleTestJob(net::URLRequest* request) |
| 65 : URLRequestTestJob(request, test_headers(), | 65 : URLRequestTestJob(request, test_headers(), |
| 66 TestData::GetInstance()->GetTestData(), true) {} | 66 TestData::GetInstance()->GetTestData(), true) {} |
| 67 | 67 |
| 68 virtual void GetResponseInfo(net::HttpResponseInfo* info) { | 68 virtual void GetResponseInfo(net::HttpResponseInfo* info) { |
| 69 URLRequestTestJob::GetResponseInfo(info); | 69 URLRequestTestJob::GetResponseInfo(info); |
| 70 if (request_->url().SchemeIsSecure()) { | 70 if (request_->url().SchemeIsSecure()) { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 NewRunnableFunction(&PrintDialogCloud::CreateDialogImpl, path_to_pdf)); | 201 NewRunnableFunction(&PrintDialogCloud::CreateDialogImpl, path_to_pdf)); |
| 202 } | 202 } |
| 203 | 203 |
| 204 bool handler_added_; | 204 bool handler_added_; |
| 205 std::string scheme_; | 205 std::string scheme_; |
| 206 std::string host_name_; | 206 std::string host_name_; |
| 207 FilePath test_data_directory_; | 207 FilePath test_data_directory_; |
| 208 AutoQuitDelegate delegate_; | 208 AutoQuitDelegate delegate_; |
| 209 }; | 209 }; |
| 210 | 210 |
| 211 URLRequestJob* PrintDialogCloudTest::Factory(net::URLRequest* request, | 211 net::URLRequestJob* PrintDialogCloudTest::Factory(net::URLRequest* request, |
| 212 const std::string& scheme) { | 212 const std::string& scheme) { |
| 213 if (TestController::GetInstance()->use_delegate()) | 213 if (TestController::GetInstance()->use_delegate()) |
| 214 request->set_delegate(TestController::GetInstance()->delegate()); | 214 request->set_delegate(TestController::GetInstance()->delegate()); |
| 215 if (request && | 215 if (request && |
| 216 (request->url() == TestController::GetInstance()->expected_url())) { | 216 (request->url() == TestController::GetInstance()->expected_url())) { |
| 217 TestController::GetInstance()->set_result(true); | 217 TestController::GetInstance()->set_result(true); |
| 218 } | 218 } |
| 219 return new SimpleTestJob(request); | 219 return new SimpleTestJob(request); |
| 220 } | 220 } |
| 221 | 221 |
| 222 IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, HandlersRegistered) { | 222 IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, HandlersRegistered) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 248 | 248 |
| 249 std::wstring window_print(L"window.print()"); | 249 std::wstring window_print(L"window.print()"); |
| 250 browser()->GetSelectedTabContents()->render_view_host()-> | 250 browser()->GetSelectedTabContents()->render_view_host()-> |
| 251 ExecuteJavascriptInWebFrame(std::wstring(), window_print); | 251 ExecuteJavascriptInWebFrame(std::wstring(), window_print); |
| 252 | 252 |
| 253 ui_test_utils::RunMessageLoop(); | 253 ui_test_utils::RunMessageLoop(); |
| 254 | 254 |
| 255 ASSERT_TRUE(TestController::GetInstance()->result()); | 255 ASSERT_TRUE(TestController::GetInstance()->result()); |
| 256 } | 256 } |
| 257 #endif | 257 #endif |
| OLD | NEW |