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

Side by Side Diff: chrome/browser/local_discovery/privet_http_unittest.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 months 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/json/json_reader.h" 6 #include "base/json/json_reader.h"
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "chrome/browser/local_discovery/privet_http_impl.h" 10 #include "chrome/browser/local_discovery/privet_http_impl.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 "}"; 215 "}";
216 #endif // ENABLE_PRINT_PREVIEW 216 #endif // ENABLE_PRINT_PREVIEW
217 217
218 // Return the representation of the given JSON that would be outputted by 218 // Return the representation of the given JSON that would be outputted by
219 // JSONWriter. This ensures the same JSON values are represented by the same 219 // JSONWriter. This ensures the same JSON values are represented by the same
220 // string. 220 // string.
221 std::string NormalizeJson(const std::string& json) { 221 std::string NormalizeJson(const std::string& json) {
222 std::string result = json; 222 std::string result = json;
223 scoped_ptr<base::Value> value(base::JSONReader::Read(result)); 223 scoped_ptr<base::Value> value(base::JSONReader::Read(result));
224 DCHECK(value); 224 DCHECK(value);
225 base::JSONWriter::Write(value.get(), &result); 225 base::JSONWriter::Write(*value, &result);
226 return result; 226 return result;
227 } 227 }
228 228
229 class MockTestURLFetcherFactoryDelegate 229 class MockTestURLFetcherFactoryDelegate
230 : public net::TestURLFetcher::DelegateForTests { 230 : public net::TestURLFetcher::DelegateForTests {
231 public: 231 public:
232 // Callback issued correspondingly to the call to the |Start()| method. 232 // Callback issued correspondingly to the call to the |Start()| method.
233 MOCK_METHOD1(OnRequestStart, void(int fetcher_id)); 233 MOCK_METHOD1(OnRequestStart, void(int fetcher_id));
234 234
235 // Callback issued correspondingly to the call to |AppendChunkToUpload|. 235 // Callback issued correspondingly to the call to |AppendChunkToUpload|.
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 1073
1074 EXPECT_TRUE(SuccessfulResponseToURL( 1074 EXPECT_TRUE(SuccessfulResponseToURL(
1075 GURL("http://10.0.0.8:6006/privet/printer/createjob"), 1075 GURL("http://10.0.0.8:6006/privet/printer/createjob"),
1076 kSampleCreatejobResponse)); 1076 kSampleCreatejobResponse));
1077 } 1077 }
1078 #endif // ENABLE_PRINT_PREVIEW 1078 #endif // ENABLE_PRINT_PREVIEW
1079 1079
1080 } // namespace 1080 } // namespace
1081 1081
1082 } // namespace local_discovery 1082 } // namespace local_discovery
OLDNEW
« no previous file with comments | « chrome/browser/extensions/test_extension_environment.cc ('k') | chrome/browser/local_discovery/privetv3_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698