OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "services/shell/background/tests/test_catalog_store.h" | |
6 | |
7 using catalog::Store; | |
8 | |
9 namespace shell { | |
10 | |
11 TestCatalogStore::TestCatalogStore(std::unique_ptr<base::ListValue> store) | |
12 : store_(std::move(store)) {} | |
13 | |
14 TestCatalogStore::~TestCatalogStore() {} | |
15 | |
16 const base::ListValue* TestCatalogStore::GetStore() { | |
17 get_store_called_ = true; | |
18 return store_.get(); | |
19 } | |
20 | |
21 void TestCatalogStore::UpdateStore(std::unique_ptr<base::ListValue> store) {} | |
22 | |
23 std::unique_ptr<base::DictionaryValue> BuildPermissiveSerializedAppInfo( | |
24 const std::string& name, | |
25 const std::string& display_name) { | |
26 std::unique_ptr<base::DictionaryValue> app(new base::DictionaryValue); | |
27 app->SetString(Store::kNameKey, name); | |
28 app->SetString(Store::kDisplayNameKey, display_name); | |
29 app->SetInteger(Store::kManifestVersionKey, 1); | |
30 | |
31 std::unique_ptr<base::DictionaryValue> capabilities( | |
32 new base::DictionaryValue); | |
33 std::unique_ptr<base::DictionaryValue> provided_classes( | |
34 new base::DictionaryValue); | |
35 std::unique_ptr<base::ListValue> provided_classes_list( | |
36 new base::ListValue); | |
37 provided_classes_list->AppendString("shell::mojom::TestService"); | |
38 provided_classes->Set("shell:test_service", std::move(provided_classes_list)); | |
39 capabilities->Set(Store::kCapabilities_ProvidedKey, | |
40 std::move(provided_classes)); | |
41 std::unique_ptr<base::DictionaryValue> required_capabilities( | |
42 new base::DictionaryValue); | |
43 std::unique_ptr<base::DictionaryValue> classes_dictionary( | |
44 new base::DictionaryValue); | |
45 std::unique_ptr<base::ListValue> classes_list(new base::ListValue); | |
46 classes_list->AppendString("shell:test_service"); | |
47 classes_dictionary->Set("classes", std::move(classes_list)); | |
48 required_capabilities->Set("*", std::move(classes_dictionary)); | |
49 capabilities->Set(Store::kCapabilities_RequiredKey, | |
50 std::move(required_capabilities)); | |
51 app->Set(Store::kCapabilitiesKey, std::move(capabilities)); | |
52 return app; | |
53 } | |
54 | |
55 } // namespace shell | |
OLD | NEW |