[Bookmark] TCT tests FIX
authorKamil Nowac <k.nowac@samsung.com>
Tue, 13 Jan 2015 11:04:08 +0000 (12:04 +0100)
committerRafal Galka <r.galka@samsung.com>
Wed, 14 Jan 2015 11:17:30 +0000 (20:17 +0900)
PASS RATE: 34 / 36

Change-Id: I5cd5d38bf071a81c6d4e1f05621a36a82f5596a2
Signed-off-by: Kamil Nowac <k.nowac@samsung.com>
src/bookmark/bookmark_api.js
src/bookmark/bookmark_instance.cc

index 99080557e5720bfd808670d8b50df19de4c20b29..7947a6206ad8b970119dee58a45ad2e92cac2f56 100644 (file)
@@ -181,10 +181,8 @@ BookmarkProvider.prototype.getFolder = function() {
     throw new tizen.WebAPIException(tizen.WebAPIException.INVALID_VALUES_ERR);
 
   var obj = new tizen.BookmarkFolder(folder[0].title);
-  _edit.allow();
   obj.id = folder[0].id;
   obj.parent = this.getFolder(folder[0].parentId);
-  _edit.disallow();
   return obj;
 };
 
@@ -226,7 +224,6 @@ BookmarkProvider.prototype.getFolderItems = function() {
       obj = new tizen.BookmarkItem(item.title, item.url);
       _edit.allow();
       obj.id = item.id;
-      obj.url = item.url;
       obj.parent = this.getFolder(item.parentId);
       _edit.disallow();
       result.push(obj);
@@ -272,7 +269,6 @@ tizen.BookmarkItem = function() {
   ]);
   var parent_;
   var id_ = null;
-  var url_;
 
   Object.defineProperties(this, {
     parent: {
@@ -280,9 +276,8 @@ tizen.BookmarkItem = function() {
         return parent_;
       },
       set: function(new_parent) {
-        if (_edit.canEdit) {
+        if (_edit.canEdit)
           parent_ = new_parent;
-        }
       },
       enumerable: true,
       nullable: true
@@ -298,24 +293,16 @@ tizen.BookmarkItem = function() {
       get: function() {
         return args.url;
       },
-      set: function(new_url) {
-        if (_edit.canEdit) {
-          url_ = new_url;
-        }
-      },
       enumerable: true,
       nullable: false
     },
     id: {
       get: function() {
-        if (!id_)
-          return 0;
         return id_;
       },
       set: function(new_id) {
-        if (_edit.canEdit) {
+        if (_edit.canEdit)
           id_ = new_id;
-        }
       },
       enumerable: false,
       nullable: true
@@ -343,9 +330,8 @@ tizen.BookmarkFolder = function() {
         return parent_;
       },
       set: function(new_parent) {
-        if (_edit.canEdit) {
+        if (_edit.canEdit)
           parent_ = new_parent;
-        }
       },
       enumerable: true,
       nullable: true
@@ -359,14 +345,11 @@ tizen.BookmarkFolder = function() {
     },
     id: {
       get: function() {
-        if (!id_)
-          return 0;
         return id_;
       },
       set: function(new_id) {
-        if (_edit.canEdit) {
+        if (_edit.canEdit)
           id_ = new_id;
-        }
       },
       enumerable: false,
       nullable: true
index 211a816cc008e2d847a00676bd79311cdb22ba5f..b4eeef5880548138a20fc9a980d690fcca9e0dbe 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <web/bookmark-adaptor.h>
 #include <string>
+#include "common/logger.h"
 
 #include "common/platform_exception.h"
 #include "common/converter.h"
@@ -93,7 +94,8 @@ void BookmarkInstance::Bookmark_get(
     obj[kType] = picojson::value(std::to_string(entry.bookmark_info.type));
     obj[kParentId] = picojson::value(std::to_string(
         entry.bookmark_info.parent));
-    obj[kUrl] = picojson::value(entry.bookmark_info.url);
+    if (!entry.bookmark_info.type)
+      obj[kUrl] = picojson::value(entry.bookmark_info.url);
 
     arr.push_back(picojson::value(obj));
   }
@@ -105,11 +107,10 @@ void BookmarkInstance::Bookmark_add(
   int saved_id =-1;
   bp_bookmark_info_fmt data = {0};
 
-  data.title = const_cast<char*>(arg.get(kTitle).to_str().c_str());
+  data.title  = const_cast<char*>(arg.get(kTitle).to_str().c_str());
   data.parent = arg.get(kParentId).get<double>();
-  data.type = arg.get(kType).get<double>();
-  data.url = const_cast<char*>(arg.get(kUrl).to_str().c_str());
-
+  data.type   = arg.get(kType).get<double>();
+  data.url    = const_cast<char*>(arg.get(kUrl).to_str().c_str());
   if (bp_bookmark_adaptor_create(&saved_id) < 0) {
     ReportError(o);
     return;