| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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[] = | 275 const char kURLGaiaToken[] = |
| 276 "https://accounts.google.com/o/oauth2/token"; | 276 "https://accounts.google.com/o/oauth2/token"; |
| 277 | 277 |
| 278 const char kSampleGaiaId[] = "12345"; |
| 278 const char kSampleUser[] = "user@host.com"; | 279 const char kSampleUser[] = "user@host.com"; |
| 279 | 280 |
| 280 class TestMessageLoopCondition { | 281 class TestMessageLoopCondition { |
| 281 public: | 282 public: |
| 282 TestMessageLoopCondition() : signaled_(false), | 283 TestMessageLoopCondition() : signaled_(false), |
| 283 waiting_(false) { | 284 waiting_(false) { |
| 284 } | 285 } |
| 285 | 286 |
| 286 ~TestMessageLoopCondition() { | 287 ~TestMessageLoopCondition() { |
| 287 } | 288 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 OnSendTo(std::string((const char*)kQueryData, sizeof(kQueryData)))) | 358 OnSendTo(std::string((const char*)kQueryData, sizeof(kQueryData)))) |
| 358 .Times(AtLeast(2)) | 359 .Times(AtLeast(2)) |
| 359 .WillOnce(InvokeWithoutArgs(&condition_devices_listed_, | 360 .WillOnce(InvokeWithoutArgs(&condition_devices_listed_, |
| 360 &TestMessageLoopCondition::Signal)) | 361 &TestMessageLoopCondition::Signal)) |
| 361 .WillRepeatedly(Return()); | 362 .WillRepeatedly(Return()); |
| 362 | 363 |
| 363 SigninManagerBase* signin_manager = | 364 SigninManagerBase* signin_manager = |
| 364 SigninManagerFactory::GetForProfile(browser()->profile()); | 365 SigninManagerFactory::GetForProfile(browser()->profile()); |
| 365 | 366 |
| 366 DCHECK(signin_manager); | 367 DCHECK(signin_manager); |
| 367 signin_manager->SetAuthenticatedUsername(kSampleUser); | 368 signin_manager->SetAuthenticatedAccountInfo(kSampleGaiaId, kSampleUser); |
| 368 | 369 |
| 369 fake_fetcher_factory().SetFakeResponse( | 370 fake_fetcher_factory().SetFakeResponse( |
| 370 GURL(kURLInfo), | 371 GURL(kURLInfo), |
| 371 kResponseInfo, | 372 kResponseInfo, |
| 372 net::HTTP_OK, | 373 net::HTTP_OK, |
| 373 net::URLRequestStatus::SUCCESS); | 374 net::URLRequestStatus::SUCCESS); |
| 374 | 375 |
| 375 fake_fetcher_factory().SetFakeResponse( | 376 fake_fetcher_factory().SetFakeResponse( |
| 376 GURL(kURLRegisterStart), | 377 GURL(kURLRegisterStart), |
| 377 kResponseRegisterStart, | 378 kResponseRegisterStart, |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 kAnnouncePacketRegistered, sizeof(kAnnouncePacketRegistered)); | 567 kAnnouncePacketRegistered, sizeof(kAnnouncePacketRegistered)); |
| 567 | 568 |
| 568 base::MessageLoop::current()->RunUntilIdle(); | 569 base::MessageLoop::current()->RunUntilIdle(); |
| 569 | 570 |
| 570 EXPECT_TRUE(WebUIBrowserTest::RunJavascriptTest("expectRegisterDone")); | 571 EXPECT_TRUE(WebUIBrowserTest::RunJavascriptTest("expectRegisterDone")); |
| 571 } | 572 } |
| 572 | 573 |
| 573 } // namespace | 574 } // namespace |
| 574 | 575 |
| 575 } // namespace local_discovery | 576 } // namespace local_discovery |
| OLD | NEW |