| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 " \"x-privet-token\" : \"MyPrivetToken\"" | 219 " \"x-privet-token\" : \"MyPrivetToken\"" |
| 220 "}"; | 220 "}"; |
| 221 | 221 |
| 222 const char kResponseInfoWithID[] = "{" | 222 const char kResponseInfoWithID[] = "{" |
| 223 " \"x-privet-token\" : \"MyPrivetToken\"," | 223 " \"x-privet-token\" : \"MyPrivetToken\"," |
| 224 " \"id\" : \"my_id\"" | 224 " \"id\" : \"my_id\"" |
| 225 "}"; | 225 "}"; |
| 226 | 226 |
| 227 const char kResponseRegisterStart[] = "{" | 227 const char kResponseRegisterStart[] = "{" |
| 228 " \"action\": \"start\"," | 228 " \"action\": \"start\"," |
| 229 " \"user\": \"user@host.com\"" | 229 " \"user\": \"user@consumer.example.com\"" |
| 230 "}"; | 230 "}"; |
| 231 | 231 |
| 232 const char kResponseRegisterClaimTokenNoConfirm[] = "{" | 232 const char kResponseRegisterClaimTokenNoConfirm[] = "{" |
| 233 " \"action\": \"getClaimToken\"," | 233 " \"action\": \"getClaimToken\"," |
| 234 " \"user\": \"user@host.com\"," | 234 " \"user\": \"user@consumer.example.com\"," |
| 235 " \"error\": \"pending_user_action\"," | 235 " \"error\": \"pending_user_action\"," |
| 236 " \"timeout\": 1" | 236 " \"timeout\": 1" |
| 237 "}"; | 237 "}"; |
| 238 | 238 |
| 239 const char kResponseRegisterClaimTokenConfirm[] = "{" | 239 const char kResponseRegisterClaimTokenConfirm[] = "{" |
| 240 " \"action\": \"getClaimToken\"," | 240 " \"action\": \"getClaimToken\"," |
| 241 " \"user\": \"user@host.com\"," | 241 " \"user\": \"user@consumer.example.com\"," |
| 242 " \"token\": \"MySampleToken\"," | 242 " \"token\": \"MySampleToken\"," |
| 243 " \"claim_url\": \"http://someurl.com/\"" | 243 " \"claim_url\": \"http://someurl.com/\"" |
| 244 "}"; | 244 "}"; |
| 245 | 245 |
| 246 const char kResponseCloudPrintConfirm[] = "{ \"success\": true }"; | 246 const char kResponseCloudPrintConfirm[] = "{ \"success\": true }"; |
| 247 | 247 |
| 248 const char kResponseRegisterComplete[] = "{" | 248 const char kResponseRegisterComplete[] = "{" |
| 249 " \"action\": \"complete\"," | 249 " \"action\": \"complete\"," |
| 250 " \"user\": \"user@host.com\"," | 250 " \"user\": \"user@consumer.example.com\"," |
| 251 " \"device_id\": \"my_id\"" | 251 " \"device_id\": \"my_id\"" |
| 252 "}"; | 252 "}"; |
| 253 | 253 |
| 254 const char kResponseGaiaToken[] = "{" | 254 const char kResponseGaiaToken[] = "{" |
| 255 " \"access_token\": \"at1\"," | 255 " \"access_token\": \"at1\"," |
| 256 " \"expires_in\": 3600," | 256 " \"expires_in\": 3600," |
| 257 " \"token_type\": \"Bearer\"" | 257 " \"token_type\": \"Bearer\"" |
| 258 "}"; | 258 "}"; |
| 259 | 259 |
| 260 const char kResponseGaiaId[] = "{" | 260 const char kResponseGaiaId[] = "{" |
| 261 " \"id\": \"12345\"" | 261 " \"id\": \"12345\"" |
| 262 "}"; | 262 "}"; |
| 263 | 263 |
| 264 const char kURLInfo[] = "http://1.2.3.4:8888/privet/info"; | 264 const char kURLInfo[] = "http://1.2.3.4:8888/privet/info"; |
| 265 | 265 |
| 266 const char kURLRegisterStart[] = | 266 const char kURLRegisterStart[] = |
| 267 "http://1.2.3.4:8888/privet/register?action=start&user=user%40host.com"; | 267 "http://1.2.3.4:8888/privet/register?action=start&" |
| 268 "user=user%40consumer.example.com"; |
| 268 | 269 |
| 269 const char kURLRegisterClaimToken[] = | 270 const char kURLRegisterClaimToken[] = |
| 270 "http://1.2.3.4:8888/privet/register?action=getClaimToken&" | 271 "http://1.2.3.4:8888/privet/register?action=getClaimToken&" |
| 271 "user=user%40host.com"; | 272 "user=user%40consumer.example.com"; |
| 272 | 273 |
| 273 const char kURLCloudPrintConfirm[] = | 274 const char kURLCloudPrintConfirm[] = |
| 274 "https://www.google.com/cloudprint/confirm?token=MySampleToken"; | 275 "https://www.google.com/cloudprint/confirm?token=MySampleToken"; |
| 275 | 276 |
| 276 const char kURLRegisterComplete[] = | 277 const char kURLRegisterComplete[] = |
| 277 "http://1.2.3.4:8888/privet/register?action=complete&user=user%40host.com"; | 278 "http://1.2.3.4:8888/privet/register?action=complete&" |
| 279 "user=user%40consumer.example.com"; |
| 278 | 280 |
| 279 const char kSampleGaiaId[] = "12345"; | 281 const char kSampleGaiaId[] = "12345"; |
| 280 const char kSampleUser[] = "user@host.com"; | 282 const char kSampleUser[] = "user@consumer.example.com"; |
| 281 | 283 |
| 282 class TestMessageLoopCondition { | 284 class TestMessageLoopCondition { |
| 283 public: | 285 public: |
| 284 TestMessageLoopCondition() : signaled_(false), | 286 TestMessageLoopCondition() : signaled_(false), |
| 285 waiting_(false) { | 287 waiting_(false) { |
| 286 } | 288 } |
| 287 | 289 |
| 288 ~TestMessageLoopCondition() { | 290 ~TestMessageLoopCondition() { |
| 289 } | 291 } |
| 290 | 292 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 kAnnouncePacketRegistered, sizeof(kAnnouncePacketRegistered)); | 576 kAnnouncePacketRegistered, sizeof(kAnnouncePacketRegistered)); |
| 575 | 577 |
| 576 base::MessageLoop::current()->RunUntilIdle(); | 578 base::MessageLoop::current()->RunUntilIdle(); |
| 577 | 579 |
| 578 EXPECT_TRUE(WebUIBrowserTest::RunJavascriptTest("expectRegisterDone")); | 580 EXPECT_TRUE(WebUIBrowserTest::RunJavascriptTest("expectRegisterDone")); |
| 579 } | 581 } |
| 580 | 582 |
| 581 } // namespace | 583 } // namespace |
| 582 | 584 |
| 583 } // namespace local_discovery | 585 } // namespace local_discovery |
| OLD | NEW |