Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ash/public/cpp/shelf_struct_traits.h" | |
| 6 | |
| 7 #include "ash/public/cpp/shelf_item.h" | |
| 8 #include "ash/public/interfaces/shelf.mojom.h" | |
| 9 #include "base/strings/utf_string_conversions.h" | |
| 10 #include "mojo/common/common_custom_types_struct_traits.h" | |
| 11 #include "skia/public/interfaces/bitmap_skbitmap_struct_traits.h" | |
| 12 #include "testing/gtest/include/gtest/gtest.h" | |
| 13 #include "ui/gfx/image/image_unittest_util.h" | |
| 14 | |
| 15 namespace ash { | |
| 16 namespace { | |
| 17 | |
| 18 TEST(ShelfItemStructTraitsTest, Basic) { | |
| 19 ShelfItem item; | |
| 20 item.type = TYPE_APP; | |
| 21 item.image = gfx::test::CreateImageSkia(32, 16); | |
| 22 item.id = 123u; | |
| 23 item.status = STATUS_RUNNING; | |
| 24 item.app_id = "foo"; | |
| 25 item.title = base::ASCIIToUTF16("bar"); | |
| 26 item.shows_tooltip = false; | |
| 27 item.pinned_by_policy = true; | |
| 28 | |
| 29 ShelfItem out_item; | |
| 30 ASSERT_TRUE(mojom::ShelfItem::Deserialize(mojom::ShelfItem::Serialize(&item), | |
| 31 &out_item)); | |
| 32 | |
| 33 EXPECT_EQ(TYPE_APP, out_item.type); | |
| 34 EXPECT_FALSE(out_item.image.isNull()); | |
| 35 EXPECT_EQ(gfx::Size(32, 16), out_item.image.size()); | |
| 36 EXPECT_EQ(123u, out_item.id); | |
| 37 EXPECT_EQ(STATUS_RUNNING, out_item.status); | |
| 38 EXPECT_EQ("foo", out_item.app_id); | |
| 39 EXPECT_EQ(base::ASCIIToUTF16("bar"), out_item.title); | |
| 40 EXPECT_FALSE(out_item.shows_tooltip); | |
| 41 EXPECT_TRUE(out_item.pinned_by_policy); | |
| 42 } | |
| 43 | |
| 44 } // namespace | |
|
James Cook
2017/03/17 02:32:29
Thanks for adding a test, and bonus points for ano
msw
2017/03/17 05:35:19
Acknowledged.
| |
| 45 } // namespace ash | |
| OLD | NEW |