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

Side by Side Diff: ash/public/cpp/shelf_struct_traits_unittest.cc

Issue 2860503002: mash: Replace int ShelfIDs with AppLaunchID strings. (Closed)
Patch Set: Fix struct traits typo. Created 3 years, 7 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/public/cpp/shelf_struct_traits.h" 5 #include "ash/public/cpp/shelf_struct_traits.h"
6 6
7 #include "ash/public/cpp/shelf_item.h" 7 #include "ash/public/cpp/shelf_item.h"
8 #include "ash/public/interfaces/shelf.mojom.h" 8 #include "ash/public/interfaces/shelf.mojom.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "mojo/common/common_custom_types_struct_traits.h" 10 #include "mojo/common/common_custom_types_struct_traits.h"
11 #include "skia/public/interfaces/bitmap_skbitmap_struct_traits.h" 11 #include "skia/public/interfaces/bitmap_skbitmap_struct_traits.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "ui/gfx/image/image_unittest_util.h" 13 #include "ui/gfx/image/image_unittest_util.h"
14 14
15 namespace ash { 15 namespace ash {
16 namespace { 16 namespace {
17 17
18 TEST(ShelfIDStructTraitsTest, Basic) {
19 ShelfID shelf_id("app_id", "launch_id");
20
21 ShelfID out_shelf_id;
22 ASSERT_TRUE(mojom::ShelfID::Deserialize(mojom::ShelfID::Serialize(&shelf_id),
23 &out_shelf_id));
24
25 EXPECT_EQ("app_id", out_shelf_id.app_id);
26 EXPECT_EQ("launch_id", out_shelf_id.launch_id);
27 }
28
18 TEST(ShelfItemStructTraitsTest, Basic) { 29 TEST(ShelfItemStructTraitsTest, Basic) {
19 ShelfItem item; 30 ShelfItem item;
20 item.type = TYPE_APP; 31 item.type = TYPE_APP;
21 item.image = gfx::test::CreateImageSkia(32, 16); 32 item.image = gfx::test::CreateImageSkia(32, 16);
22 item.id = 123u; 33 item.id = ShelfID("app_id", "launch_id");
23 item.status = STATUS_RUNNING; 34 item.status = STATUS_RUNNING;
24 item.app_launch_id = AppLaunchId("app_id", "launch_id");
25 item.title = base::ASCIIToUTF16("title"); 35 item.title = base::ASCIIToUTF16("title");
26 item.shows_tooltip = false; 36 item.shows_tooltip = false;
27 item.pinned_by_policy = true; 37 item.pinned_by_policy = true;
28 38
29 ShelfItem out_item; 39 ShelfItem out_item;
30 ASSERT_TRUE(mojom::ShelfItem::Deserialize(mojom::ShelfItem::Serialize(&item), 40 ASSERT_TRUE(mojom::ShelfItem::Deserialize(mojom::ShelfItem::Serialize(&item),
31 &out_item)); 41 &out_item));
32 42
33 EXPECT_EQ(TYPE_APP, out_item.type); 43 EXPECT_EQ(TYPE_APP, out_item.type);
34 EXPECT_FALSE(out_item.image.isNull()); 44 EXPECT_FALSE(out_item.image.isNull());
35 EXPECT_EQ(gfx::Size(32, 16), out_item.image.size()); 45 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); 46 EXPECT_EQ(STATUS_RUNNING, out_item.status);
38 EXPECT_EQ("app_id", out_item.app_launch_id.app_id()); 47 EXPECT_EQ(ShelfID("app_id", "launch_id"), out_item.id);
39 EXPECT_EQ("launch_id", out_item.app_launch_id.launch_id());
40 EXPECT_EQ(base::ASCIIToUTF16("title"), out_item.title); 48 EXPECT_EQ(base::ASCIIToUTF16("title"), out_item.title);
41 EXPECT_FALSE(out_item.shows_tooltip); 49 EXPECT_FALSE(out_item.shows_tooltip);
42 EXPECT_TRUE(out_item.pinned_by_policy); 50 EXPECT_TRUE(out_item.pinned_by_policy);
43 } 51 }
44 52
45 } // namespace 53 } // namespace
46 } // namespace ash 54 } // namespace ash
OLDNEW
« 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