Replace clouddevices with weave in documentation and tests
Removed OAuth scope parameter as optional.

BUG:25627281

Change-Id: I1b2bce5b86fd7a0be89c446b5a13cc9c49244992
Reviewed-on: https://weave-review.googlesource.com/1538
Reviewed-by: Alex Vakulenko <avakulenko@google.com>
diff --git a/src/device_registration_info.cc b/src/device_registration_info.cc
index 8945b66..d2b10a9 100644
--- a/src/device_registration_info.cc
+++ b/src/device_registration_info.cc
@@ -606,7 +606,6 @@
        {"client_id", GetSettings().client_id},
        {"client_secret", GetSettings().client_secret},
        {"redirect_uri", "oob"},
-       {"scope", "https://www.googleapis.com/auth/clouddevices"},
        {"grant_type", "authorization_code"}});
   sender2.Send(base::Bind(&DeviceRegistrationInfo::RegisterDeviceOnAuthCodeSent,
                           weak_factory_.GetWeakPtr(), cloud_id, robot_account,
diff --git a/src/device_registration_info.h b/src/device_registration_info.h
index f3bacc6..9d9d21f 100644
--- a/src/device_registration_info.h
+++ b/src/device_registration_info.h
@@ -85,20 +85,20 @@
 
   // Returns the GCD service request URL. If |subpath| is specified, it is
   // appended to the base URL which is normally
-  //    https://www.googleapis.com/clouddevices/v1/".
+  //    https://www.googleapis.com/weave/v1/".
   // If |params| are specified, each key-value pair is formatted using
   // WebParamsEncode() and appended to URL as a query
   // string.
   // So, calling:
   //    GetServiceURL("ticket", {{"key","apiKey"}})
   // will return something like:
-  //    https://www.googleapis.com/clouddevices/v1/ticket?key=apiKey
+  //    https://www.googleapis.com/weave/v1/ticket?key=apiKey
   std::string GetServiceURL(const std::string& subpath = {},
                             const WebParamList& params = {}) const;
 
   // Returns a service URL to access the registered device on GCD server.
   // The base URL used to construct the full URL looks like this:
-  //    https://www.googleapis.com/clouddevices/v1/devices/<cloud_id>/
+  //    https://www.googleapis.com/weave/v1/devices/<cloud_id>/
   std::string GetDeviceURL(const std::string& subpath = {},
                            const WebParamList& params = {}) const;
 
diff --git a/src/device_registration_info_unittest.cc b/src/device_registration_info_unittest.cc
index 91b8ff5..9edd396 100644
--- a/src/device_registration_info_unittest.cc
+++ b/src/device_registration_info_unittest.cc
@@ -217,15 +217,13 @@
 TEST_F(DeviceRegistrationInfoTest, GetOAuthURL) {
   EXPECT_EQ(test_data::kOAuthURL, dev_reg_->GetOAuthURL());
   std::string url = test_data::kOAuthURL;
-  url += "auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fclouddevices&";
-  url += "redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&";
+  url += "auth?redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&";
   url += "response_type=code&";
   url += "client_id=";
   url += test_data::kClientId;
   EXPECT_EQ(url, dev_reg_->GetOAuthURL(
                      "auth",
-                     {{"scope", "https://www.googleapis.com/auth/clouddevices"},
-                      {"redirect_uri", "urn:ietf:wg:oauth:2.0:oob"},
+                     {{"redirect_uri", "urn:ietf:wg:oauth:2.0:oob"},
                       {"response_type", "code"},
                       {"client_id", test_data::kClientId}}));
 }
@@ -332,7 +330,7 @@
             json.SetString("channel.supportedType", "xmpp");
             json.SetString("deviceKind", "vendor");
             json.SetString("id", test_data::kDeviceId);
-            json.SetString("kind", "clouddevices#device");
+            json.SetString("kind", "weave#device");
             callback.Run(ReplyWithJson(200, json), nullptr);
           })));
 
@@ -427,13 +425,13 @@
 
         base::DictionaryValue json_resp;
         json_resp.SetString("id", test_data::kClaimTicketId);
-        json_resp.SetString("kind", "clouddevices#registrationTicket");
+        json_resp.SetString("kind", "weave#registrationTicket");
         json_resp.SetString("oauthClientId", test_data::kClientId);
         base::DictionaryValue* device_draft = nullptr;
         EXPECT_TRUE(json->GetDictionary("deviceDraft", &device_draft));
         device_draft = device_draft->DeepCopy();
         device_draft->SetString("id", test_data::kDeviceId);
-        device_draft->SetString("kind", "clouddevices#device");
+        device_draft->SetString("kind", "weave#device");
         json_resp.Set("deviceDraft", device_draft);
 
         callback.Run(ReplyWithJson(200, json_resp), nullptr);
@@ -447,11 +445,11 @@
           Invoke([](const HttpClient::SendRequestCallback& callback) {
             base::DictionaryValue json;
             json.SetString("id", test_data::kClaimTicketId);
-            json.SetString("kind", "clouddevices#registrationTicket");
+            json.SetString("kind", "weave#registrationTicket");
             json.SetString("oauthClientId", test_data::kClientId);
             json.SetString("userEmail", "user@email.com");
             json.SetString("deviceDraft.id", test_data::kDeviceId);
-            json.SetString("deviceDraft.kind", "clouddevices#device");
+            json.SetString("deviceDraft.kind", "weave#device");
             json.SetString("deviceDraft.channel.supportedType", "xmpp");
             json.SetString("robotAccountEmail", test_data::kRobotAccountEmail);
             json.SetString("robotAccountAuthorizationCode",
@@ -471,10 +469,7 @@
         EXPECT_EQ(test_data::kClientId, GetFormField(data, "client_id"));
         EXPECT_EQ(test_data::kClientSecret,
                   GetFormField(data, "client_secret"));
-
         EXPECT_EQ("oob", GetFormField(data, "redirect_uri"));
-        EXPECT_EQ("https://www.googleapis.com/auth/clouddevices",
-                  GetFormField(data, "scope"));
 
         base::DictionaryValue json;
         json.SetString("access_token", test_data::kAccessToken);
diff --git a/src/weave_unittest.cc b/src/weave_unittest.cc
index f009814..c2f1e8f 100644
--- a/src/weave_unittest.cc
+++ b/src/weave_unittest.cc
@@ -56,7 +56,7 @@
 })";
 
 const char kDeviceResource[] = R"({
-  "kind": "clouddevices#device",
+  "kind": "weave#device",
   "id": "CLOUD_ID",
   "channel": {
     "supportedType": "pull"
@@ -96,7 +96,7 @@
 })";
 
 const char kRegistrationResponse[] = R"({
-  "kind": "clouddevices#registrationTicket",
+  "kind": "weave#registrationTicket",
   "id": "TICKET_ID",
   "deviceId": "CLOUD_ID",
   "oauthClientId": "CLIENT_ID",
@@ -106,7 +106,7 @@
 })";
 
 const char kRegistrationFinalResponse[] = R"({
-  "kind": "clouddevices#registrationTicket",
+  "kind": "weave#registrationTicket",
   "id": "TICKET_ID",
   "deviceId": "CLOUD_ID",
   "oauthClientId": "CLIENT_ID",