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

Side by Side Diff: services/catalog/entry_unittest.cc

Issue 2425563004: Support reading multiple InterfaceProviderSpecs from manifests (Closed)
Patch Set: . Created 4 years, 1 month 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 | « services/catalog/entry.cc ('k') | services/catalog/instance.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 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
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
OLDNEW
« no previous file with comments | « services/catalog/entry.cc ('k') | services/catalog/instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698