Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(521)

Side by Side Diff: chrome/browser/printing/cloud_print/privet_http_unittest.cc

Issue 2458833005: Move printing defines to buildflag system. (Closed)
Patch Set: Merge Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/printing/cloud_print/privet_http.h" 5 #include "chrome/browser/printing/cloud_print/privet_http.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
11 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
16 #include "base/threading/thread_task_runner_handle.h" 16 #include "base/threading/thread_task_runner_handle.h"
17 #include "chrome/browser/printing/cloud_print/privet_http_impl.h" 17 #include "chrome/browser/printing/cloud_print/privet_http_impl.h"
18 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
19 #include "content/public/test/test_browser_thread_bundle.h" 19 #include "content/public/test/test_browser_thread_bundle.h"
20 #include "net/test/embedded_test_server/embedded_test_server.h" 20 #include "net/test/embedded_test_server/embedded_test_server.h"
21 #include "net/url_request/test_url_fetcher_factory.h" 21 #include "net/url_request/test_url_fetcher_factory.h"
22 #include "net/url_request/url_request_test_util.h" 22 #include "net/url_request/url_request_test_util.h"
23 #include "printing/features/features.h"
23 #include "testing/gmock/include/gmock/gmock.h" 24 #include "testing/gmock/include/gmock/gmock.h"
24 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
25 26
26 #if defined(ENABLE_PRINT_PREVIEW) 27 #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
27 #include "chrome/browser/printing/pwg_raster_converter.h" 28 #include "chrome/browser/printing/pwg_raster_converter.h"
28 #include "printing/pwg_raster_settings.h" 29 #include "printing/pwg_raster_settings.h"
29 #endif // ENABLE_PRINT_PREVIEW 30 #endif // ENABLE_PRINT_PREVIEW
30 31
31 namespace cloud_print { 32 namespace cloud_print {
32 33
33 namespace { 34 namespace {
34 35
35 using testing::NiceMock; 36 using testing::NiceMock;
36 using testing::StrictMock; 37 using testing::StrictMock;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 const char kSampleCapabilitiesResponse[] = "{" 132 const char kSampleCapabilitiesResponse[] = "{"
132 "\"version\" : \"1.0\"," 133 "\"version\" : \"1.0\","
133 "\"printer\" : {" 134 "\"printer\" : {"
134 " \"supported_content_type\" : [" 135 " \"supported_content_type\" : ["
135 " { \"content_type\" : \"application/pdf\" }," 136 " { \"content_type\" : \"application/pdf\" },"
136 " { \"content_type\" : \"image/pwg-raster\" }" 137 " { \"content_type\" : \"image/pwg-raster\" }"
137 " ]" 138 " ]"
138 "}" 139 "}"
139 "}"; 140 "}";
140 141
141 #if defined(ENABLE_PRINT_PREVIEW) 142 #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
142 const char kSampleInfoResponseWithCreatejob[] = "{" 143 const char kSampleInfoResponseWithCreatejob[] = "{"
143 " \"version\": \"1.0\"," 144 " \"version\": \"1.0\","
144 " \"name\": \"Common printer\"," 145 " \"name\": \"Common printer\","
145 " \"description\": \"Printer connected through Chrome connector\"," 146 " \"description\": \"Printer connected through Chrome connector\","
146 " \"url\": \"https://www.google.com/cloudprint\"," 147 " \"url\": \"https://www.google.com/cloudprint\","
147 " \"type\": [" 148 " \"type\": ["
148 " \"printer\"" 149 " \"printer\""
149 " ]," 150 " ],"
150 " \"id\": \"\"," 151 " \"id\": \"\","
151 " \"device_state\": \"idle\"," 152 " \"device_state\": \"idle\","
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 727
727 EXPECT_TRUE( 728 EXPECT_TRUE(
728 SuccessfulResponseToURL(GetUrl("/privet/info"), kSampleInfoResponse)); 729 SuccessfulResponseToURL(GetUrl("/privet/info"), kSampleInfoResponse));
729 730
730 EXPECT_CALL(capabilities_callback_, OnPrivetJSONDoneInternal()); 731 EXPECT_CALL(capabilities_callback_, OnPrivetJSONDoneInternal());
731 732
732 EXPECT_TRUE(SuccessfulResponseToURL(GetUrl("/privet/capabilities"), 733 EXPECT_TRUE(SuccessfulResponseToURL(GetUrl("/privet/capabilities"),
733 kSampleCapabilitiesResponse)); 734 kSampleCapabilitiesResponse));
734 } 735 }
735 736
736 #if defined(ENABLE_PRINT_PREVIEW) 737 #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
737 // A note on PWG raster conversion: The PWG raster converter used simply 738 // A note on PWG raster conversion: The PWG raster converter used simply
738 // converts strings to file paths based on them by appending "test.pdf", since 739 // converts strings to file paths based on them by appending "test.pdf", since
739 // it's easier to test that way. Instead of using a mock, we simply check if the 740 // it's easier to test that way. Instead of using a mock, we simply check if the
740 // request is uploading a file that is based on this pattern. 741 // request is uploading a file that is based on this pattern.
741 class FakePWGRasterConverter : public printing::PWGRasterConverter { 742 class FakePWGRasterConverter : public printing::PWGRasterConverter {
742 public: 743 public:
743 void Start(base::RefCountedMemory* data, 744 void Start(base::RefCountedMemory* data,
744 const printing::PdfRenderSettings& conversion_settings, 745 const printing::PdfRenderSettings& conversion_settings,
745 const printing::PwgRasterSettings& bitmap_settings, 746 const printing::PwgRasterSettings& bitmap_settings,
746 const ResultCallback& callback) override { 747 const ResultCallback& callback) override {
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 base::Closure quit_; 1117 base::Closure quit_;
1117 }; 1118 };
1118 1119
1119 TEST_F(PrivetHttpWithServerTest, HttpServer) { 1120 TEST_F(PrivetHttpWithServerTest, HttpServer) {
1120 EXPECT_TRUE(Run()); 1121 EXPECT_TRUE(Run());
1121 } 1122 }
1122 1123
1123 } // namespace 1124 } // namespace
1124 1125
1125 } // namespace cloud_print 1126 } // namespace cloud_print
OLDNEW
« no previous file with comments | « chrome/browser/printing/cloud_print/privet_http_impl.cc ('k') | chrome/browser/printing/print_view_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698