| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/local_discovery/privet_http.h" | 5 #include "chrome/browser/local_discovery/privet_http.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 8 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| 9 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 10 #include "chrome/browser/local_discovery/privet_http_impl.h" | 12 #include "chrome/browser/local_discovery/privet_http_impl.h" |
| 11 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 12 #include "content/public/test/test_browser_thread_bundle.h" | 14 #include "content/public/test/test_browser_thread_bundle.h" |
| 13 #include "net/test/embedded_test_server/embedded_test_server.h" | 15 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 14 #include "net/url_request/test_url_fetcher_factory.h" | 16 #include "net/url_request/test_url_fetcher_factory.h" |
| 15 #include "net/url_request/url_request_test_util.h" | 17 #include "net/url_request/url_request_test_util.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 void SetUp() override { | 757 void SetUp() override { |
| 756 PrivetURLFetcher::ResetTokenMapForTests(); | 758 PrivetURLFetcher::ResetTokenMapForTests(); |
| 757 | 759 |
| 758 local_print_operation_ = privet_client_->CreateLocalPrintOperation( | 760 local_print_operation_ = privet_client_->CreateLocalPrintOperation( |
| 759 &local_print_delegate_); | 761 &local_print_delegate_); |
| 760 | 762 |
| 761 scoped_ptr<FakePWGRasterConverter> pwg_converter( | 763 scoped_ptr<FakePWGRasterConverter> pwg_converter( |
| 762 new FakePWGRasterConverter); | 764 new FakePWGRasterConverter); |
| 763 pwg_converter_ = pwg_converter.get(); | 765 pwg_converter_ = pwg_converter.get(); |
| 764 local_print_operation_->SetPWGRasterConverterForTesting( | 766 local_print_operation_->SetPWGRasterConverterForTesting( |
| 765 pwg_converter.Pass()); | 767 std::move(pwg_converter)); |
| 766 } | 768 } |
| 767 | 769 |
| 768 scoped_refptr<base::RefCountedBytes> RefCountedBytesFromString( | 770 scoped_refptr<base::RefCountedBytes> RefCountedBytesFromString( |
| 769 std::string str) { | 771 std::string str) { |
| 770 std::vector<unsigned char> str_vec; | 772 std::vector<unsigned char> str_vec; |
| 771 str_vec.insert(str_vec.begin(), str.begin(), str.end()); | 773 str_vec.insert(str_vec.begin(), str.begin(), str.end()); |
| 772 return scoped_refptr<base::RefCountedBytes>( | 774 return scoped_refptr<base::RefCountedBytes>( |
| 773 base::RefCountedBytes::TakeVector(&str_vec)); | 775 base::RefCountedBytes::TakeVector(&str_vec)); |
| 774 } | 776 } |
| 775 | 777 |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 base::Closure quit_; | 1112 base::Closure quit_; |
| 1111 }; | 1113 }; |
| 1112 | 1114 |
| 1113 TEST_F(PrivetHttpWithServerTest, HttpServer) { | 1115 TEST_F(PrivetHttpWithServerTest, HttpServer) { |
| 1114 EXPECT_TRUE(Run()); | 1116 EXPECT_TRUE(Run()); |
| 1115 } | 1117 } |
| 1116 | 1118 |
| 1117 } // namespace | 1119 } // namespace |
| 1118 | 1120 |
| 1119 } // namespace local_discovery | 1121 } // namespace local_discovery |
| OLD | NEW |