Upstream version 11.39.260.0
[platform/framework/web/crosswalk.git] / src / xwalk / application / common / manifest_handlers / widget_handler_unittest.cc
index 1e734df..b750627 100644 (file)
@@ -93,7 +93,8 @@ class WidgetHandlerTest: public testing::Test {
   // No Preferences and full other information
   void SetAllInfoToManifest(base::DictionaryValue* manifest) {
     // Insert some key-value pairs into manifest use full key
-    manifest->SetString(kW3CNamespaceKey,      kW3CNamespacePrefix);
+    manifest->SetString(keys::kWidgetNamespaceKey,
+                        keys::kWidgetNamespacePrefix);
     manifest->SetString(keys::kAuthorKey,      author);
     manifest->SetString(keys::kDescriptionKey, decription);
     manifest->SetString(keys::kNameKey,        name);
@@ -124,7 +125,7 @@ class WidgetHandlerTest: public testing::Test {
 
 TEST_F(WidgetHandlerTest, ParseManifestWithOnlyNameAndVersion) {
   base::DictionaryValue manifest;
-  manifest.SetString(kW3CNamespaceKey, kW3CNamespacePrefix);
+  manifest.SetString(keys::kWidgetNamespaceKey, keys::kWidgetNamespacePrefix);
   manifest.SetString(keys::kNameKey, "no name");
   manifest.SetString(keys::kVersionKey, "0");
 
@@ -220,5 +221,23 @@ TEST_F(WidgetHandlerTest,
   EXPECT_TRUE(widget->Equals(widget_parsed_from_manifest));
 }
 
+TEST_F(WidgetHandlerTest,
+       ParseManifestWithInvalidAuthorHrefValue) {
+  scoped_ptr<base::DictionaryValue> manifest(new base::DictionaryValue);
+  SetAllInfoToManifest(manifest.get());
+  manifest->SetString(keys::kAuthorHrefKey, "INVALID_HREF");
+
+  // Create an application use this manifest,
+  scoped_refptr<ApplicationData> application;
+  application = CreateApplication(*(manifest.get()));
+  EXPECT_TRUE(application.get());
+  EXPECT_EQ(application->manifest_type(), Manifest::TYPE_WIDGET);
+  // Get widget info from this application.
+  WidgetInfo* info = GetWidgetInfo(application);
+  EXPECT_TRUE(info);
+  std::string authorhref;
+  info->GetWidgetInfo()->GetString(keys::kAuthorHrefKey, &authorhref);
+  EXPECT_TRUE(authorhref.empty());
+}
 }  // namespace application
 }  // namespace xwalk