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

Unified Diff: ash/public/cpp/shelf_struct_traits_unittest.cc

Issue 2750463009: mash: Fix ShelfItem mojo struct; add enums and traits. (Closed)
Patch Set: Address comment. Created 3 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 | « ash/public/cpp/shelf_struct_traits.cc ('k') | ash/public/cpp/shelf_types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/public/cpp/shelf_struct_traits_unittest.cc
diff --git a/ash/public/cpp/shelf_struct_traits_unittest.cc b/ash/public/cpp/shelf_struct_traits_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a44ffbb1e622998b0f3180a957efb98a54cd7a69
--- /dev/null
+++ b/ash/public/cpp/shelf_struct_traits_unittest.cc
@@ -0,0 +1,45 @@
+// Copyright 2017 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 "ash/public/cpp/shelf_struct_traits.h"
+
+#include "ash/public/cpp/shelf_item.h"
+#include "ash/public/interfaces/shelf.mojom.h"
+#include "base/strings/utf_string_conversions.h"
+#include "mojo/common/common_custom_types_struct_traits.h"
+#include "skia/public/interfaces/bitmap_skbitmap_struct_traits.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gfx/image/image_unittest_util.h"
+
+namespace ash {
+namespace {
+
+TEST(ShelfItemStructTraitsTest, Basic) {
+ ShelfItem item;
+ item.type = TYPE_APP;
+ item.image = gfx::test::CreateImageSkia(32, 16);
+ item.id = 123u;
+ item.status = STATUS_RUNNING;
+ item.app_id = "foo";
+ item.title = base::ASCIIToUTF16("bar");
+ item.shows_tooltip = false;
+ item.pinned_by_policy = true;
+
+ ShelfItem out_item;
+ ASSERT_TRUE(mojom::ShelfItem::Deserialize(mojom::ShelfItem::Serialize(&item),
+ &out_item));
+
+ EXPECT_EQ(TYPE_APP, out_item.type);
+ EXPECT_FALSE(out_item.image.isNull());
+ EXPECT_EQ(gfx::Size(32, 16), out_item.image.size());
+ EXPECT_EQ(123u, out_item.id);
+ EXPECT_EQ(STATUS_RUNNING, out_item.status);
+ EXPECT_EQ("foo", out_item.app_id);
+ EXPECT_EQ(base::ASCIIToUTF16("bar"), out_item.title);
+ EXPECT_FALSE(out_item.shows_tooltip);
+ EXPECT_TRUE(out_item.pinned_by_policy);
+}
+
+} // namespace
+} // namespace ash
« no previous file with comments | « ash/public/cpp/shelf_struct_traits.cc ('k') | ash/public/cpp/shelf_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698