libweave: Convert the blacklist trait into a standard one

Now that revokation blacklist trait has been standardized, stop
using a custom trait and rename it to match the name on the server.

BUG: 26520268

Change-Id: I0555a600027796b5b4882f973f6455601d88c81e
Reviewed-on: https://weave-review.googlesource.com/3107
Reviewed-by: Alex Vakulenko <avakulenko@google.com>
diff --git a/src/access_api_handler.cc b/src/access_api_handler.cc
index 5e0882e..906fe25 100644
--- a/src/access_api_handler.cc
+++ b/src/access_api_handler.cc
@@ -18,13 +18,13 @@
 namespace {
 
 const char kComponent[] = "accessControl";
-const char kTrait[] = "_accessRevocationList";
-const char kStateCapacity[] = "_accessRevocationList.capacity";
+const char kTrait[] = "blacklist";
+const char kStateCapacity[] = "blacklist.capacity";
 const char kUserId[] = "userId";
 const char kApplicationId[] = "applicationId";
 const char kExpirationTime[] = "expirationTime";
 const char kRevocationTimestamp[] = "revocationTimestamp";
-const char kRevocationList[] = "revocationList";
+const char kBlacklistEntries[] = "blacklistEntries";
 
 bool GetIds(const base::DictionaryValue& parameters,
             std::vector<uint8_t>* user_id_decoded,
@@ -55,7 +55,7 @@
                                    AccessRevocationManager* manager)
     : device_{device}, manager_{manager} {
   device_->AddTraitDefinitionsFromJson(R"({
-    "_accessRevocationList": {
+    "blacklist": {
       "commands": {
         "add": {
           "minimalRole": "owner",
@@ -78,7 +78,7 @@
           "minimalRole": "owner",
           "parameters": {},
           "results": {
-            "revocationList": {
+            "blacklistEntries": {
               "type": "array",
               "items": {
                 "type": "object",
@@ -114,10 +114,10 @@
   UpdateState();
 
   device_->AddCommandHandler(
-      kComponent, "_accessRevocationList.add",
+      kComponent, "blacklist.add",
       base::Bind(&AccessApiHandler::Block, weak_ptr_factory_.GetWeakPtr()));
   device_->AddCommandHandler(
-      kComponent, "_accessRevocationList.list",
+      kComponent, "blacklist.list",
       base::Bind(&AccessApiHandler::List, weak_ptr_factory_.GetWeakPtr()));
 }
 
@@ -180,7 +180,7 @@
   }
 
   base::DictionaryValue result;
-  result.Set(kRevocationList, std::move(entries));
+  result.Set(kBlacklistEntries, std::move(entries));
 
   command->Complete(result, nullptr);
 }
diff --git a/src/access_api_handler.h b/src/access_api_handler.h
index 16eaa6f..b84bfff 100644
--- a/src/access_api_handler.h
+++ b/src/access_api_handler.h
@@ -16,12 +16,12 @@
 class Command;
 class Device;
 
-// Handles commands for '_accessRevocationList' trait.
+// Handles commands for 'blacklist' trait.
 // Objects of the class subscribe for notification from CommandManager and
 // execute incoming commands.
 // Handled commands:
-//  _accessRevocationList.revoke
-//  _accessRevocationList.list
+//  blacklist.add
+//  blacklist.list
 class AccessApiHandler final {
  public:
   AccessApiHandler(Device* device, AccessRevocationManager* manager);
diff --git a/src/access_api_handler_unittest.cc b/src/access_api_handler_unittest.cc
index f53a6d1..d7bb4e6 100644
--- a/src/access_api_handler_unittest.cc
+++ b/src/access_api_handler_unittest.cc
@@ -44,8 +44,7 @@
         }));
 
     EXPECT_CALL(device_,
-                AddCommandHandler(_, AnyOf("_accessRevocationList.add",
-                                           "_accessRevocationList.list"),
+                AddCommandHandler(_, AnyOf("blacklist.add", "blacklist.list"),
                                   _))
         .WillRepeatedly(
             Invoke(&component_manager_, &ComponentManager::AddCommandHandler));
@@ -71,13 +70,13 @@
 
   std::unique_ptr<base::DictionaryValue> GetState() {
     std::string path =
-        component_manager_.FindComponentWithTrait("_accessRevocationList");
+        component_manager_.FindComponentWithTrait("blacklist");
     EXPECT_FALSE(path.empty());
     const auto* component = component_manager_.FindComponent(path, nullptr);
     EXPECT_TRUE(component);
     const base::DictionaryValue* state = nullptr;
     EXPECT_TRUE(
-        component->GetDictionary("state._accessRevocationList", &state));
+        component->GetDictionary("state.blacklist", &state));
     return state->CreateDeepCopy();
   }
 
@@ -91,7 +90,7 @@
 TEST_F(AccessApiHandlerTest, Initialization) {
   const base::DictionaryValue* trait = nullptr;
   ASSERT_TRUE(component_manager_.GetTraits().GetDictionary(
-      "_accessRevocationList", &trait));
+      "blacklist", &trait));
 
   auto expected = R"({
     "commands": {
@@ -116,7 +115,7 @@
         "minimalRole": "owner",
         "parameters": {},
         "results": {
-          "revocationList": {
+          "blacklistEntries": {
             "type": "array",
             "items": {
               "type": "object",
@@ -168,7 +167,7 @@
   EXPECT_CALL(access_manager_, GetSize()).WillRepeatedly(Return(1));
 
   AddCommand(R"({
-    'name' : '_accessRevocationList.add',
+    'name' : 'blacklist.add',
     'component': 'accessControl',
     'parameters': {
       'userId': 'AQID',
@@ -199,7 +198,7 @@
   EXPECT_CALL(access_manager_, GetSize()).WillRepeatedly(Return(4));
 
   auto expected = R"({
-    "revocationList": [ {
+    "blacklistEntries": [ {
       "applicationId": "FRYX",
       "userId": "CwwN"
     }, {
@@ -209,7 +208,7 @@
   })";
 
   const auto& results = AddCommand(R"({
-    'name' : '_accessRevocationList.list',
+    'name' : 'blacklist.list',
     'component': 'accessControl',
     'parameters': {
     }