--- /dev/null
+// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache-2.0 license that can be
+// found in the LICENSE file.
+
+#include "unit_tests/manifest_test.h"
+
+namespace bf = boost::filesystem;
+namespace ci = common_installer;
+
+TEST_F(ManifestTest, WatchApplicationElement_Valid) {
+ StepParseRunner runner(GetMyName());
+ ASSERT_TRUE(runner.Run());
+ manifest_x* m = runner.GetManifest();
+ ASSERT_NE(m, nullptr);
+ ASSERT_CSTR_EQ(m->package, "package0id");
+ auto apps = GListRange<application_x*>(m->application);
+ ASSERT_EQ(Size(&apps), 1);
+ application_x* app = *apps.begin();
+ ASSERT_CSTR_EQ(app->appid, "package0id.appid");
+ ASSERT_CSTR_EQ(app->component_type, "watchapp");
+}
+
+TEST_F(ManifestTest, WatchApplicationElement_Appid_Missing) {
+ StepParseRunner runner(GetMyName());
+ ASSERT_FALSE(runner.Run());
+}
+
+TEST_F(ManifestTest, WatchApplicationElement_Appid_Invalid) {
+ StepParseRunner runner(GetMyName());
+ ASSERT_FALSE(runner.Run());
+}
+
+TEST_F(ManifestTest, WatchApplicationElement_Label_Missing) {
+ StepParseRunner runner(GetMyName());
+ ASSERT_TRUE(runner.Run());
+ manifest_x* m = runner.GetManifest();
+ ASSERT_NE(m, nullptr);
+ auto apps = GListRange<application_x*>(m->application);
+ ASSERT_EQ(Size(&apps), 1);
+ application_x* app = *apps.begin();
+ auto labels = GListRange<label_x*>(app->label);
+ ASSERT_EQ(Size(&labels), 0);
+}
+
+TEST_F(ManifestTest, WatchApplicationElement_Label_Valid) {
+ StepParseRunner runner(GetMyName());
+ ASSERT_TRUE(runner.Run());
+ manifest_x* m = runner.GetManifest();
+ ASSERT_NE(m, nullptr);
+ auto apps = GListRange<application_x*>(m->application);
+ ASSERT_EQ(Size(&apps), 1);
+ application_x* app = *apps.begin();
+ auto labels = GListRange<label_x*>(app->label);
+ ASSERT_EQ(Size(&labels), 1);
+ ASSERT_CSTR_EQ((*labels.begin())->text, "label");
+ ASSERT_CSTR_EQ((*labels.begin())->lang, DEFAULT_LOCALE);
+}
+
+TEST_F(ManifestTest, WatchApplicationElement_Label_Invalid) {
+ StepParseRunner runner(GetMyName());
+ ASSERT_FALSE(runner.Run());
+}
+
+TEST_F(ManifestTest, WatchApplicationElement_Icon_Missing) {
+ StepParseRunner runner(GetMyName());
+ ASSERT_TRUE(runner.Run());
+ manifest_x* m = runner.GetManifest();
+ ASSERT_NE(m, nullptr);
+ auto apps = GListRange<application_x*>(m->application);
+ ASSERT_EQ(Size(&apps), 1);
+ application_x* app = *apps.begin();
+ auto icons = GListRange<icon_x*>(app->icon);
+ ASSERT_EQ(Size(&icons), 0);
+}
+
+TEST_F(ManifestTest, WatchApplicationElement_Icon_Invalid) {
+ StepParseRunner runner(GetMyName());
+ ASSERT_FALSE(runner.Run());
+}
+
+TEST_F(ManifestTest, WatchApplicationElement_Icon_Valid) {
+ StepParseRunner runner(GetMyName());
+ ASSERT_TRUE(runner.Run());
+ manifest_x* m = runner.GetManifest();
+ ASSERT_NE(m, nullptr);
+ auto apps = GListRange<application_x*>(m->application);
+ ASSERT_EQ(Size(&apps), 1);
+ application_x* app = *apps.begin();
+ auto icons = GListRange<icon_x*>(app->icon);
+ ASSERT_EQ(Size(&icons), 1);
+ ASSERT_EQ(bf::path((*icons.begin())->text).filename().string(),
+ "test_icon.png");
+}
+
+TEST_F(ManifestTest, WatchApplicationElement_AmbientSupport_Missing) {
+ StepParseRunner runner(GetMyName());
+ ASSERT_TRUE(runner.Run());
+ manifest_x* m = runner.GetManifest();
+ ASSERT_NE(m, nullptr);
+ auto apps = GListRange<application_x*>(m->application);
+ ASSERT_EQ(Size(&apps), 1);
+ application_x* app = *apps.begin();
+ ASSERT_CSTR_EQ(app->ambient_support, "false");
+}
+
+TEST_F(ManifestTest, WatchApplicationElement_AmbientSupport_False) {
+ StepParseRunner runner(GetMyName());
+ ASSERT_TRUE(runner.Run());
+ manifest_x* m = runner.GetManifest();
+ ASSERT_NE(m, nullptr);
+ auto apps = GListRange<application_x*>(m->application);
+ ASSERT_EQ(Size(&apps), 1);
+ application_x* app = *apps.begin();
+ ASSERT_CSTR_EQ(app->ambient_support, "false");
+}
+
+
+TEST_F(ManifestTest, WatchApplicationElement_AmbientSupport_True) {
+ StepParseRunner runner(GetMyName());
+ ASSERT_TRUE(runner.Run());
+ manifest_x* m = runner.GetManifest();
+ ASSERT_NE(m, nullptr);
+ auto apps = GListRange<application_x*>(m->application);
+ ASSERT_EQ(Size(&apps), 1);
+ application_x* app = *apps.begin();
+ ASSERT_CSTR_EQ(app->ambient_support, "true");
+}
+
+TEST_F(ManifestTest, WatchApplicationElement_AmbientSupport_Invalid) {
+ StepParseRunner runner(GetMyName());
+ ASSERT_FALSE(runner.Run());
+}