1 // Copyright (c) 2014 Samsung Electronics Co., Ltd 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.
5 #ifndef XWALK_APPLICATION_COMMON_MANIFEST_HANDLERS_UNITTEST_UTIL_H_
6 #define XWALK_APPLICATION_COMMON_MANIFEST_HANDLERS_UNITTEST_UTIL_H_
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/values.h"
13 #include "xwalk/application/common/application_data.h"
14 #include "xwalk/application/common/manifest.h"
17 namespace application {
19 extern const char kDefaultManifestName[];
20 extern const char kDefaultManifestVersion[];
21 extern const char kDefaultWidgetName[];
22 extern const char kDefaultWidgetVersion[];
26 extern const char kDefaultWidgetPackageId[];
27 extern const char kDefaultWidgetApplicationName[];
28 extern const char kDefaultWidgetRequiredVersion[];
30 #endif // defined(OS_TIZEN)
32 // Creates a minimal valid manifest configuration.
33 scoped_ptr<base::DictionaryValue> CreateDefaultManifestConfig();
35 // Creates a minimal valid widget configuration.
36 scoped_ptr<base::DictionaryValue> CreateDefaultWidgetConfig();
38 // Creates an ApplicationData for specified configuration data.
39 scoped_refptr<ApplicationData> CreateApplication(Manifest::Type type,
40 const base::DictionaryValue& manifest);
42 // Creates a path to element under parent element.
43 // For example, calling MakePath("a.b", "c") produces "a.b.c".
44 std::string MakeElementPath(const std::string& parent,
45 const std::string& element);
47 // In a parent dictionary adds a child dictionary under a specified key.
48 // If it is a first dictionary under the key, it is added as dictionary
49 // directly, otherwise it is added as another dictionary in a list of
50 // dictionaries. If parent is null, it does nothing.
51 bool AddDictionary(const std::string& key,
52 scoped_ptr<base::DictionaryValue> child, base::DictionaryValue* parent);
54 } // namespace application
57 #endif // XWALK_APPLICATION_COMMON_MANIFEST_HANDLERS_UNITTEST_UTIL_H_