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

Unified Diff: mojo/converters/base/base_type_converters_unittest.cc

Issue 1841863002: Update monet. (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: 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/converters/base/base_type_converters.cc ('k') | mojo/converters/url/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/converters/base/base_type_converters_unittest.cc
diff --git a/mojo/common/common_type_converters_unittest.cc b/mojo/converters/base/base_type_converters_unittest.cc
similarity index 55%
rename from mojo/common/common_type_converters_unittest.cc
rename to mojo/converters/base/base_type_converters_unittest.cc
index cffd1a617c8f9ded54547be5ce578195d70dbe3c..351eebc903ec23f281fdddc9b1df044439821583 100644
--- a/mojo/common/common_type_converters_unittest.cc
+++ b/mojo/converters/base/base_type_converters_unittest.cc
@@ -2,16 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "mojo/common/common_type_converters.h"
+#include "mojo/converters/base/base_type_converters.h"
+#include "base/bind.h"
#include "base/strings/utf_string_conversions.h"
-#include "mojo/common/url_type_converters.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "url/gurl.h"
namespace mojo {
-namespace common {
-namespace test {
namespace {
void ExpectEqualsStringPiece(const std::string& expected,
@@ -19,8 +16,7 @@ void ExpectEqualsStringPiece(const std::string& expected,
EXPECT_EQ(expected, str.as_string());
}
-void ExpectEqualsMojoString(const std::string& expected,
- const String& str) {
+void ExpectEqualsMojoString(const std::string& expected, const String& str) {
EXPECT_EQ(expected, str.get());
}
@@ -29,14 +25,11 @@ void ExpectEqualsString16(const base::string16& expected,
EXPECT_EQ(expected, actual);
}
-void ExpectEqualsMojoString(const base::string16& expected,
- const String& str) {
+void ExpectEqualsMojoString(const base::string16& expected, const String& str) {
EXPECT_EQ(expected, str.To<base::string16>());
}
-} // namespace
-
-TEST(CommonTypeConvertersTest, StringPiece) {
+TEST(BaseTypeConvertersTest, StringPiece) {
std::string kText("hello world");
base::StringPiece string_piece(kText);
@@ -54,7 +47,7 @@ TEST(CommonTypeConvertersTest, StringPiece) {
EXPECT_TRUE(empty_string_piece.empty());
}
-TEST(CommonTypeConvertersTest, String16) {
+TEST(BaseTypeConvertersTest, String16) {
const base::string16 string16(base::ASCIIToUTF16("hello world"));
const String mojo_string(String::From(string16));
@@ -69,43 +62,5 @@ TEST(CommonTypeConvertersTest, String16) {
ExpectEqualsMojoString(base::string16(), String::From(base::string16()));
}
-TEST(CommonTypeConvertersTest, URL) {
- GURL url("mojo:foo");
- String mojo_string(String::From(url));
-
- ASSERT_EQ(url.spec(), mojo_string);
- EXPECT_EQ(url.spec(), mojo_string.To<GURL>().spec());
- EXPECT_EQ(url.spec(), String::From(url));
-
- GURL invalid = String().To<GURL>();
- ASSERT_TRUE(invalid.spec().empty());
-
- String string_from_invalid = String::From(invalid);
- EXPECT_FALSE(string_from_invalid.is_null());
- ASSERT_EQ(0U, string_from_invalid.size());
-}
-
-TEST(CommonTypeConvertersTest, ArrayUint8ToStdString) {
- Array<uint8_t> data(4);
- data[0] = 'd';
- data[1] = 'a';
- data[2] = 't';
- data[3] = 'a';
-
- EXPECT_EQ("data", data.To<std::string>());
-}
-
-TEST(CommonTypeConvertersTest, StdStringToArrayUint8) {
- std::string input("data");
- Array<uint8_t> data = Array<uint8_t>::From(input);
-
- ASSERT_EQ(4ul, data.size());
- EXPECT_EQ('d', data[0]);
- EXPECT_EQ('a', data[1]);
- EXPECT_EQ('t', data[2]);
- EXPECT_EQ('a', data[3]);
-}
-
-} // namespace test
-} // namespace common
+} // namespace
} // namespace mojo
« no previous file with comments | « mojo/converters/base/base_type_converters.cc ('k') | mojo/converters/url/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698