Upstream version 11.39.264.0
[platform/framework/web/crosswalk.git] / src / xwalk / application / common / manifest_handlers / unittest_util.h
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.
4
5 #ifndef XWALK_APPLICATION_COMMON_MANIFEST_HANDLERS_UNITTEST_UTIL_H_
6 #define XWALK_APPLICATION_COMMON_MANIFEST_HANDLERS_UNITTEST_UTIL_H_
7
8 #include <string>
9 #include <vector>
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"
15
16 namespace xwalk {
17 namespace application {
18
19 extern const char kDefaultManifestName[];
20 extern const char kDefaultManifestVersion[];
21 extern const char kDefaultWidgetName[];
22 extern const char kDefaultWidgetVersion[];
23
24 #if defined(OS_TIZEN)
25
26 extern const char kDefaultWidgetPackageId[];
27 extern const char kDefaultWidgetApplicationName[];
28 extern const char kDefaultWidgetRequiredVersion[];
29
30 #endif  // defined(OS_TIZEN)
31
32 // Creates a minimal valid manifest configuration.
33 scoped_ptr<base::DictionaryValue> CreateDefaultManifestConfig();
34
35 // Creates a minimal valid widget configuration.
36 scoped_ptr<base::DictionaryValue> CreateDefaultWidgetConfig();
37
38 // Creates an ApplicationData for specified configuration data.
39 scoped_refptr<ApplicationData> CreateApplication(Manifest::Type type,
40     const base::DictionaryValue& manifest);
41
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);
46
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);
53
54 }  // namespace application
55 }  // namespace xwalk
56
57 #endif  // XWALK_APPLICATION_COMMON_MANIFEST_HANDLERS_UNITTEST_UTIL_H_