OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/catalog/entry.h" | 5 #include "services/catalog/entry.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/json/json_file_value_serializer.h" | 8 #include "base/json/json_file_value_serializer.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 TEST_F(EntryTest, ConnectionSpec) { | 70 TEST_F(EntryTest, ConnectionSpec) { |
71 std::unique_ptr<Entry> entry = ReadEntry("connection_spec", nullptr); | 71 std::unique_ptr<Entry> entry = ReadEntry("connection_spec", nullptr); |
72 | 72 |
73 EXPECT_EQ("service:foo", entry->name()); | 73 EXPECT_EQ("service:foo", entry->name()); |
74 EXPECT_EQ("bar", entry->qualifier()); | 74 EXPECT_EQ("bar", entry->qualifier()); |
75 EXPECT_EQ("Foo", entry->display_name()); | 75 EXPECT_EQ("Foo", entry->display_name()); |
76 service_manager::InterfaceProviderSpec spec; | 76 service_manager::InterfaceProviderSpec spec; |
77 service_manager::CapabilitySet capabilities; | 77 service_manager::CapabilitySet capabilities; |
78 capabilities.insert("bar:bar"); | 78 capabilities.insert("bar:bar"); |
79 spec.requires["service:bar"] = capabilities; | 79 spec.requires["service:bar"] = capabilities; |
80 EXPECT_EQ(spec, entry->connection_spec()); | 80 service_manager::InterfaceProviderSpecMap specs; |
| 81 specs[service_manager::mojom::kServiceManager_ConnectorSpec] = spec; |
| 82 EXPECT_EQ(specs, entry->interface_provider_specs()); |
81 } | 83 } |
82 | 84 |
83 TEST_F(EntryTest, Serialization) { | 85 TEST_F(EntryTest, Serialization) { |
84 std::unique_ptr<base::Value> value; | 86 std::unique_ptr<base::Value> value; |
85 std::unique_ptr<Entry> entry = ReadEntry("serialization", &value); | 87 std::unique_ptr<Entry> entry = ReadEntry("serialization", &value); |
86 | 88 |
87 std::unique_ptr<base::DictionaryValue> serialized(entry->Serialize()); | 89 std::unique_ptr<base::DictionaryValue> serialized(entry->Serialize()); |
88 | 90 |
89 // We can't just compare values, since during deserialization some of the | 91 // We can't just compare values, since during deserialization some of the |
90 // lists get converted to std::sets, which are sorted, so Value::Equals will | 92 // lists get converted to std::sets, which are sorted, so Value::Equals will |
91 // fail. | 93 // fail. |
92 std::unique_ptr<Entry> reconstituted = Entry::Deserialize(*serialized.get()); | 94 std::unique_ptr<Entry> reconstituted = Entry::Deserialize(*serialized.get()); |
93 EXPECT_EQ(*entry, *reconstituted); | 95 EXPECT_EQ(*entry, *reconstituted); |
94 } | 96 } |
95 | 97 |
96 TEST_F(EntryTest, Malformed) { | 98 TEST_F(EntryTest, Malformed) { |
97 std::unique_ptr<base::Value> value = ReadManifest("malformed"); | 99 std::unique_ptr<base::Value> value = ReadManifest("malformed"); |
98 EXPECT_FALSE(value.get()); | 100 EXPECT_FALSE(value.get()); |
99 } | 101 } |
100 | 102 |
101 | 103 |
102 } // namespace catalog | 104 } // namespace catalog |
OLD | NEW |