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

Unified Diff: mojo/common/common_type_converters_unittest.cc

Issue 1814003002: Implement the renderer side of the mojo based local storage implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/common/common_type_converters.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/common/common_type_converters_unittest.cc
diff --git a/mojo/common/common_type_converters_unittest.cc b/mojo/common/common_type_converters_unittest.cc
index af8f64004dabee20c6be51c2527dd8e9c272b7a4..302bcbe54ab6d4fcbfcdbf17dad3ffa369700ecb 100644
--- a/mojo/common/common_type_converters_unittest.cc
+++ b/mojo/common/common_type_converters_unittest.cc
@@ -108,6 +108,33 @@ TEST(CommonTypeConvertersTest, StdStringToArrayUint8) {
EXPECT_EQ('a', data[3]);
}
+TEST(CommonTypeConvertersTest, ArrayUint8ToString16) {
+ Array<uint8_t> data(8);
+ data[0] = 'd';
+ data[2] = 'a';
+ data[4] = 't';
+ data[6] = 'a';
+
+ EXPECT_EQ(base::ASCIIToUTF16("data"), data.To<base::string16>());
+}
+
+TEST(CommonTypeConvertersTest, String16ToArrayUint8) {
+ base::string16 input(base::ASCIIToUTF16("data"));
+ Array<uint8_t> data = Array<uint8_t>::From(input);
+
+ ASSERT_EQ(8ul, data.size());
+ EXPECT_EQ('d', data[0]);
+ EXPECT_EQ('a', data[2]);
+ EXPECT_EQ('t', data[4]);
+ EXPECT_EQ('a', data[6]);
+}
+
+TEST(CommonTypeConvertersTest, String16ToArrayUint8AndBack) {
+ base::string16 input(base::ASCIIToUTF16("data"));
+ Array<uint8_t> data = Array<uint8_t>::From(input);
+ EXPECT_EQ(input, data.To<base::string16>());
+}
+
TEST(CommonTypeConvertersTest, EmptyStringToArrayUint8) {
Array<uint8_t> data = Array<uint8_t>::From(std::string());
« no previous file with comments | « mojo/common/common_type_converters.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698