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/printing/cloud_print/privet_http.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "chrome/browser/local_discovery/privet_http_impl.h" | 12 #include "chrome/browser/printing/cloud_print/privet_http_impl.h" |
13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
14 #include "content/public/test/test_browser_thread_bundle.h" | 14 #include "content/public/test/test_browser_thread_bundle.h" |
15 #include "net/test/embedded_test_server/embedded_test_server.h" | 15 #include "net/test/embedded_test_server/embedded_test_server.h" |
16 #include "net/url_request/test_url_fetcher_factory.h" | 16 #include "net/url_request/test_url_fetcher_factory.h" |
17 #include "net/url_request/url_request_test_util.h" | 17 #include "net/url_request/url_request_test_util.h" |
18 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 | 20 |
21 #if defined(ENABLE_PRINT_PREVIEW) | 21 #if defined(ENABLE_PRINT_PREVIEW) |
22 #include "chrome/browser/local_discovery/pwg_raster_converter.h" | 22 #include "chrome/browser/printing/pwg_raster_converter.h" |
23 #include "printing/pwg_raster_settings.h" | 23 #include "printing/pwg_raster_settings.h" |
24 #endif // ENABLE_PRINT_PREVIEW | 24 #endif // ENABLE_PRINT_PREVIEW |
25 | 25 |
26 namespace local_discovery { | 26 namespace cloud_print { |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 using testing::NiceMock; | 30 using testing::NiceMock; |
31 using testing::StrictMock; | 31 using testing::StrictMock; |
32 using testing::TestWithParam; | 32 using testing::TestWithParam; |
33 using testing::ValuesIn; | 33 using testing::ValuesIn; |
34 | 34 |
35 using content::BrowserThread; | 35 using content::BrowserThread; |
36 using net::EmbeddedTestServer; | 36 using net::EmbeddedTestServer; |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 | 726 |
727 EXPECT_TRUE(SuccessfulResponseToURL(GetUrl("/privet/capabilities"), | 727 EXPECT_TRUE(SuccessfulResponseToURL(GetUrl("/privet/capabilities"), |
728 kSampleCapabilitiesResponse)); | 728 kSampleCapabilitiesResponse)); |
729 } | 729 } |
730 | 730 |
731 #if defined(ENABLE_PRINT_PREVIEW) | 731 #if defined(ENABLE_PRINT_PREVIEW) |
732 // A note on PWG raster conversion: The PWG raster converter used simply | 732 // A note on PWG raster conversion: The PWG raster converter used simply |
733 // converts strings to file paths based on them by appending "test.pdf", since | 733 // converts strings to file paths based on them by appending "test.pdf", since |
734 // it's easier to test that way. Instead of using a mock, we simply check if the | 734 // it's easier to test that way. Instead of using a mock, we simply check if the |
735 // request is uploading a file that is based on this pattern. | 735 // request is uploading a file that is based on this pattern. |
736 class FakePWGRasterConverter : public PWGRasterConverter { | 736 class FakePWGRasterConverter : public printing::PWGRasterConverter { |
737 public: | 737 public: |
738 void Start(base::RefCountedMemory* data, | 738 void Start(base::RefCountedMemory* data, |
739 const printing::PdfRenderSettings& conversion_settings, | 739 const printing::PdfRenderSettings& conversion_settings, |
740 const printing::PwgRasterSettings& bitmap_settings, | 740 const printing::PwgRasterSettings& bitmap_settings, |
741 const ResultCallback& callback) override { | 741 const ResultCallback& callback) override { |
742 bitmap_settings_ = bitmap_settings; | 742 bitmap_settings_ = bitmap_settings; |
743 std::string data_str(data->front_as<char>(), data->size()); | 743 std::string data_str(data->front_as<char>(), data->size()); |
744 callback.Run(true, base::FilePath().AppendASCII(data_str + "test.pdf")); | 744 callback.Run(true, base::FilePath().AppendASCII(data_str + "test.pdf")); |
745 } | 745 } |
746 | 746 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 | 1111 |
1112 base::Closure quit_; | 1112 base::Closure quit_; |
1113 }; | 1113 }; |
1114 | 1114 |
1115 TEST_F(PrivetHttpWithServerTest, HttpServer) { | 1115 TEST_F(PrivetHttpWithServerTest, HttpServer) { |
1116 EXPECT_TRUE(Run()); | 1116 EXPECT_TRUE(Run()); |
1117 } | 1117 } |
1118 | 1118 |
1119 } // namespace | 1119 } // namespace |
1120 | 1120 |
1121 } // namespace local_discovery | 1121 } // namespace cloud_print |
OLD | NEW |