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

Side by Side Diff: chrome/browser/extensions/api/messaging/native_messaging_host_manifest_unittest.cc

Issue 100823007: Stop doing unnecessary UTF-8 to UTF-16 conversions in JSONWriter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/extensions/api/messaging/native_messaging_host_manifest .h" 5 #include "chrome/browser/extensions/api/messaging/native_messaging_host_manifest .h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/json/string_escape.h" 10 #include "base/json/string_escape.h"
(...skipping 17 matching lines...) Expand all
28 virtual void SetUp() OVERRIDE { 28 virtual void SetUp() OVERRIDE {
29 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 29 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
30 manifest_path_ = temp_dir_.path().AppendASCII("test.json"); 30 manifest_path_ = temp_dir_.path().AppendASCII("test.json");
31 } 31 }
32 32
33 protected: 33 protected:
34 bool WriteManifest(const std::string& name, 34 bool WriteManifest(const std::string& name,
35 const std::string& path, 35 const std::string& path,
36 const std::string& origin) { 36 const std::string& origin) {
37 std::string escaped_path; 37 std::string escaped_path;
38 base::JsonDoubleQuote(path, false, &escaped_path); 38 base::EscapeJSONString(path, false, &escaped_path);
Mark Mentovai 2013/12/06 15:35:12 Why don’t you use the simpler non-out-param-having
Robert Sesek 2013/12/09 19:52:09 Done.
39 return WriteManifest("{" 39 return WriteManifest("{"
40 " \"name\": \"" + name + "\"," 40 " \"name\": \"" + name + "\","
41 " \"description\": \"Native Messaging Test\"," 41 " \"description\": \"Native Messaging Test\","
42 " \"path\": \"" + escaped_path + "\"," 42 " \"path\": \"" + escaped_path + "\","
43 " \"type\": \"stdio\"," 43 " \"type\": \"stdio\","
44 " \"allowed_origins\": [" 44 " \"allowed_origins\": ["
45 " \"" + origin + "\"" 45 " \"" + origin + "\""
46 " ]" 46 " ]"
47 "}"); 47 "}");
48 } 48 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 "chrome-extension://*/")); 108 "chrome-extension://*/"));
109 109
110 std::string error_message; 110 std::string error_message;
111 scoped_ptr<NativeMessagingHostManifest> manifest = 111 scoped_ptr<NativeMessagingHostManifest> manifest =
112 NativeMessagingHostManifest::Load(manifest_path_, &error_message); 112 NativeMessagingHostManifest::Load(manifest_path_, &error_message);
113 ASSERT_FALSE(manifest); 113 ASSERT_FALSE(manifest);
114 EXPECT_FALSE(error_message.empty()); 114 EXPECT_FALSE(error_message.empty());
115 } 115 }
116 116
117 } // namespace extensions 117 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698