diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-10 23:54:07 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-10 23:54:07 +0000 |
commit | 79f41fe0e2ce7832cfa0683e1d0d4b90542355b7 (patch) | |
tree | e31c51ffe55ce0bcc6ec8583b62dc48462658520 /chrome/common/mac | |
parent | 351ea9de5eb226b8d12eb761103c4a632052083a (diff) | |
download | chromium_src-79f41fe0e2ce7832cfa0683e1d0d4b90542355b7.zip chromium_src-79f41fe0e2ce7832cfa0683e1d0d4b90542355b7.tar.gz chromium_src-79f41fe0e2ce7832cfa0683e1d0d4b90542355b7.tar.bz2 |
Remove nscoder_util
This was upstreamed for iOS, but the code that uses it won't be
upstreamed into chrome/ under the new plan, and it's not clear yet
where it will live. Nothing else is using it.
BUG=None
Review URL: https://codereview.chromium.org/26880005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@228050 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/mac')
-rw-r--r-- | chrome/common/mac/nscoder_util.h | 22 | ||||
-rw-r--r-- | chrome/common/mac/nscoder_util.mm | 24 | ||||
-rw-r--r-- | chrome/common/mac/nscoder_util_unittest.mm | 57 |
3 files changed, 0 insertions, 103 deletions
diff --git a/chrome/common/mac/nscoder_util.h b/chrome/common/mac/nscoder_util.h deleted file mode 100644 index 7e73f24..0000000 --- a/chrome/common/mac/nscoder_util.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_COMMON_MAC_NSCODER_UTIL_H_ -#define CHROME_COMMON_MAC_NSCODER_UTIL_H_ - -#import <Foundation/Foundation.h> - -#include <string> - -namespace nscoder_util { - -// Archives a std::string in an Objective-C key archiver. -void EncodeString(NSCoder* coder, NSString* key, const std::string& string); - -// Decode a std::string from an Objective-C key unarchiver. -std::string DecodeString(NSCoder* decoder, NSString* key); - -} // namespace nscoder_util - -#endif // CHROME_COMMON_MAC_NSCODER_UTIL_H_ diff --git a/chrome/common/mac/nscoder_util.mm b/chrome/common/mac/nscoder_util.mm deleted file mode 100644 index 6fb1b1c..0000000 --- a/chrome/common/mac/nscoder_util.mm +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <string> - -#include "chrome/common/mac/nscoder_util.h" - -namespace nscoder_util { - -void EncodeString(NSCoder* coder, NSString* key, const std::string& string) { - [coder encodeBytes:reinterpret_cast<const uint8_t*>(string.data()) - length:string.size() - forKey:key]; -} - -std::string DecodeString(NSCoder* decoder, NSString* key) { - NSUInteger length; - const uint8_t* bytes = [decoder decodeBytesForKey:key - returnedLength:&length]; - return std::string(reinterpret_cast<const char*>(bytes), length); -} - -} // namespace nscoder_util diff --git a/chrome/common/mac/nscoder_util_unittest.mm b/chrome/common/mac/nscoder_util_unittest.mm deleted file mode 100644 index ed84a94..0000000 --- a/chrome/common/mac/nscoder_util_unittest.mm +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import <Foundation/Foundation.h> - -#include "base/basictypes.h" -#include "base/mac/scoped_nsobject.h" -#include "chrome/common/mac/nscoder_util.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "testing/platform_test.h" - -namespace { - -typedef PlatformTest NSCoderStdStringTest; - -const char* testStrings[] = { - "Arf", - "", - "This is working™", - "古池や蛙飛込む水の音\nふるいけやかわずとびこむみずのおと", - "ἀγεωμέτρητος μηδεὶς εἰσίτω", - "Bang!\t\n" -}; - -TEST_F(NSCoderStdStringTest, encodeDecode) { - for (size_t i = 0; i < arraysize(testStrings); ++i) { - NSMutableData *data = [NSMutableData data]; - - base::scoped_nsobject<NSKeyedArchiver> archiver( - [[NSKeyedArchiver alloc] initForWritingWithMutableData:data]); - nscoder_util::EncodeString(archiver, @"test", testStrings[i]); - [archiver finishEncoding]; - - base::scoped_nsobject<NSKeyedUnarchiver> unarchiver( - [[NSKeyedUnarchiver alloc] initForReadingWithData:data]); - const std::string decoded = nscoder_util::DecodeString(unarchiver, @"test"); - - EXPECT_EQ(decoded, testStrings[i]); - } -} - -TEST_F(NSCoderStdStringTest, decodeEmpty) { - NSMutableData *data = [NSMutableData data]; - - base::scoped_nsobject<NSKeyedArchiver> archiver( - [[NSKeyedArchiver alloc] initForWritingWithMutableData:data]); - [archiver finishEncoding]; - - base::scoped_nsobject<NSKeyedUnarchiver> unarchiver( - [[NSKeyedUnarchiver alloc] initForReadingWithData:data]); - const std::string decoded = nscoder_util::DecodeString(unarchiver, @"test"); - - EXPECT_EQ(decoded, ""); -} - -} // namespace |