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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 const char kURLRegisterClaimToken[] = | 265 const char kURLRegisterClaimToken[] = |
266 "http://1.2.3.4:8888/privet/register?action=getClaimToken&" | 266 "http://1.2.3.4:8888/privet/register?action=getClaimToken&" |
267 "user=user%40host.com"; | 267 "user=user%40host.com"; |
268 | 268 |
269 const char kURLCloudPrintConfirm[] = | 269 const char kURLCloudPrintConfirm[] = |
270 "https://www.google.com/cloudprint/confirm?token=MySampleToken"; | 270 "https://www.google.com/cloudprint/confirm?token=MySampleToken"; |
271 | 271 |
272 const char kURLRegisterComplete[] = | 272 const char kURLRegisterComplete[] = |
273 "http://1.2.3.4:8888/privet/register?action=complete&user=user%40host.com"; | 273 "http://1.2.3.4:8888/privet/register?action=complete&user=user%40host.com"; |
274 | 274 |
275 const char kURLGaiaToken[] = | |
276 "https://accounts.google.com/o/oauth2/token"; | |
277 | |
278 const char kSampleGaiaId[] = "12345"; | 275 const char kSampleGaiaId[] = "12345"; |
279 const char kSampleUser[] = "user@host.com"; | 276 const char kSampleUser[] = "user@host.com"; |
280 | 277 |
281 class TestMessageLoopCondition { | 278 class TestMessageLoopCondition { |
282 public: | 279 public: |
283 TestMessageLoopCondition() : signaled_(false), | 280 TestMessageLoopCondition() : signaled_(false), |
284 waiting_(false) { | 281 waiting_(false) { |
285 } | 282 } |
286 | 283 |
287 ~TestMessageLoopCondition() { | 284 ~TestMessageLoopCondition() { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 net::HTTP_OK, | 388 net::HTTP_OK, |
392 net::URLRequestStatus::SUCCESS); | 389 net::URLRequestStatus::SUCCESS); |
393 | 390 |
394 fake_fetcher_factory().SetFakeResponse( | 391 fake_fetcher_factory().SetFakeResponse( |
395 GURL(kURLRegisterComplete), | 392 GURL(kURLRegisterComplete), |
396 kResponseRegisterComplete, | 393 kResponseRegisterComplete, |
397 net::HTTP_OK, | 394 net::HTTP_OK, |
398 net::URLRequestStatus::SUCCESS); | 395 net::URLRequestStatus::SUCCESS); |
399 | 396 |
400 fake_fetcher_factory().SetFakeResponse( | 397 fake_fetcher_factory().SetFakeResponse( |
401 GURL(kURLGaiaToken), | 398 GaiaUrls::GetInstance()->oauth2_token_url(), |
402 kResponseGaiaToken, | 399 kResponseGaiaToken, |
403 net::HTTP_OK, | 400 net::HTTP_OK, |
404 net::URLRequestStatus::SUCCESS); | 401 net::URLRequestStatus::SUCCESS); |
405 | 402 |
406 EXPECT_CALL(fake_url_fetcher_creator(), OnCreateFakeURLFetcher( | 403 EXPECT_CALL(fake_url_fetcher_creator(), OnCreateFakeURLFetcher( |
407 kURLGaiaToken)) | 404 GaiaUrls::GetInstance()->oauth2_token_url().spec())) |
408 .Times(AnyNumber()); | 405 .Times(AnyNumber()); |
409 | 406 |
410 fake_fetcher_factory().SetFakeResponse( | 407 fake_fetcher_factory().SetFakeResponse( |
411 GaiaUrls::GetInstance()->oauth_user_info_url(), | 408 GaiaUrls::GetInstance()->oauth_user_info_url(), |
412 kResponseGaiaId, | 409 kResponseGaiaId, |
413 net::HTTP_OK, | 410 net::HTTP_OK, |
414 net::URLRequestStatus::SUCCESS); | 411 net::URLRequestStatus::SUCCESS); |
415 | 412 |
416 EXPECT_CALL(fake_url_fetcher_creator(), OnCreateFakeURLFetcher( | 413 EXPECT_CALL(fake_url_fetcher_creator(), OnCreateFakeURLFetcher( |
417 GaiaUrls::GetInstance()->oauth_user_info_url().spec())) | 414 GaiaUrls::GetInstance()->oauth_user_info_url().spec())) |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 kAnnouncePacketRegistered, sizeof(kAnnouncePacketRegistered)); | 564 kAnnouncePacketRegistered, sizeof(kAnnouncePacketRegistered)); |
568 | 565 |
569 base::MessageLoop::current()->RunUntilIdle(); | 566 base::MessageLoop::current()->RunUntilIdle(); |
570 | 567 |
571 EXPECT_TRUE(WebUIBrowserTest::RunJavascriptTest("expectRegisterDone")); | 568 EXPECT_TRUE(WebUIBrowserTest::RunJavascriptTest("expectRegisterDone")); |
572 } | 569 } |
573 | 570 |
574 } // namespace | 571 } // namespace |
575 | 572 |
576 } // namespace local_discovery | 573 } // namespace local_discovery |
OLD | NEW |