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

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

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | 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 28 matching lines...) Expand all
39 " \"description\": \"Native Messaging Test\"," 39 " \"description\": \"Native Messaging Test\","
40 " \"path\": " + base::GetQuotedJSONString(path) + "," 40 " \"path\": " + base::GetQuotedJSONString(path) + ","
41 " \"type\": \"stdio\"," 41 " \"type\": \"stdio\","
42 " \"allowed_origins\": [" 42 " \"allowed_origins\": ["
43 " \"" + origin + "\"" 43 " \"" + origin + "\""
44 " ]" 44 " ]"
45 "}"); 45 "}");
46 } 46 }
47 47
48 bool WriteManifest(const std::string& manifest_content) { 48 bool WriteManifest(const std::string& manifest_content) {
49 return file_util::WriteFile( 49 return base::WriteFile(
50 manifest_path_, manifest_content.data(), manifest_content.size()); 50 manifest_path_, manifest_content.data(), manifest_content.size());
51 } 51 }
52 52
53 base::ScopedTempDir temp_dir_; 53 base::ScopedTempDir temp_dir_;
54 base::FilePath manifest_path_; 54 base::FilePath manifest_path_;
55 }; 55 };
56 56
57 TEST_F(NativeMessagingHostManifestTest, HostNameValidation) { 57 TEST_F(NativeMessagingHostManifestTest, HostNameValidation) {
58 EXPECT_TRUE(NativeMessagingHostManifest::IsValidName("a")); 58 EXPECT_TRUE(NativeMessagingHostManifest::IsValidName("a"));
59 EXPECT_TRUE(NativeMessagingHostManifest::IsValidName("foo")); 59 EXPECT_TRUE(NativeMessagingHostManifest::IsValidName("foo"));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 "chrome-extension://*/")); 106 "chrome-extension://*/"));
107 107
108 std::string error_message; 108 std::string error_message;
109 scoped_ptr<NativeMessagingHostManifest> manifest = 109 scoped_ptr<NativeMessagingHostManifest> manifest =
110 NativeMessagingHostManifest::Load(manifest_path_, &error_message); 110 NativeMessagingHostManifest::Load(manifest_path_, &error_message);
111 ASSERT_FALSE(manifest); 111 ASSERT_FALSE(manifest);
112 EXPECT_FALSE(error_message.empty()); 112 EXPECT_FALSE(error_message.empty());
113 } 113 }
114 114
115 } // namespace extensions 115 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698