| 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 | 338 |
| 339 class LocalDiscoveryUITest : public WebUIBrowserTest { | 339 class LocalDiscoveryUITest : public WebUIBrowserTest { |
| 340 public: | 340 public: |
| 341 LocalDiscoveryUITest() : fake_fetcher_factory_( | 341 LocalDiscoveryUITest() : fake_fetcher_factory_( |
| 342 &fetcher_impl_factory_, | 342 &fetcher_impl_factory_, |
| 343 fake_url_fetcher_creator_.callback()) { | 343 fake_url_fetcher_creator_.callback()) { |
| 344 } | 344 } |
| 345 virtual ~LocalDiscoveryUITest() { | 345 virtual ~LocalDiscoveryUITest() { |
| 346 } | 346 } |
| 347 | 347 |
| 348 virtual void SetUpOnMainThread() OVERRIDE { | 348 virtual void SetUpOnMainThread() override { |
| 349 WebUIBrowserTest::SetUpOnMainThread(); | 349 WebUIBrowserTest::SetUpOnMainThread(); |
| 350 | 350 |
| 351 test_service_discovery_client_ = new TestServiceDiscoveryClient(); | 351 test_service_discovery_client_ = new TestServiceDiscoveryClient(); |
| 352 test_service_discovery_client_->Start(); | 352 test_service_discovery_client_->Start(); |
| 353 EXPECT_CALL( | 353 EXPECT_CALL( |
| 354 *test_service_discovery_client_.get(), | 354 *test_service_discovery_client_.get(), |
| 355 OnSendTo(std::string((const char*)kQueryData, sizeof(kQueryData)))) | 355 OnSendTo(std::string((const char*)kQueryData, sizeof(kQueryData)))) |
| 356 .Times(AtLeast(2)) | 356 .Times(AtLeast(2)) |
| 357 .WillOnce(InvokeWithoutArgs(&condition_devices_listed_, | 357 .WillOnce(InvokeWithoutArgs(&condition_devices_listed_, |
| 358 &TestMessageLoopCondition::Signal)) | 358 &TestMessageLoopCondition::Signal)) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 .Times(AnyNumber()); | 421 .Times(AnyNumber()); |
| 422 | 422 |
| 423 ProfileOAuth2TokenService* token_service = | 423 ProfileOAuth2TokenService* token_service = |
| 424 ProfileOAuth2TokenServiceFactory::GetForProfile(browser()->profile()); | 424 ProfileOAuth2TokenServiceFactory::GetForProfile(browser()->profile()); |
| 425 | 425 |
| 426 token_service->UpdateCredentials("user@host.com", "MyFakeToken"); | 426 token_service->UpdateCredentials("user@host.com", "MyFakeToken"); |
| 427 | 427 |
| 428 AddLibrary(base::FilePath(FILE_PATH_LITERAL("local_discovery_ui_test.js"))); | 428 AddLibrary(base::FilePath(FILE_PATH_LITERAL("local_discovery_ui_test.js"))); |
| 429 } | 429 } |
| 430 | 430 |
| 431 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 431 virtual void SetUpCommandLine(CommandLine* command_line) override { |
| 432 WebUIBrowserTest::SetUpCommandLine(command_line); | 432 WebUIBrowserTest::SetUpCommandLine(command_line); |
| 433 } | 433 } |
| 434 | 434 |
| 435 void RunFor(base::TimeDelta time_period) { | 435 void RunFor(base::TimeDelta time_period) { |
| 436 base::CancelableCallback<void()> callback(base::Bind( | 436 base::CancelableCallback<void()> callback(base::Bind( |
| 437 &base::MessageLoop::Quit, base::Unretained( | 437 &base::MessageLoop::Quit, base::Unretained( |
| 438 base::MessageLoop::current()))); | 438 base::MessageLoop::current()))); |
| 439 base::MessageLoop::current()->PostDelayedTask( | 439 base::MessageLoop::current()->PostDelayedTask( |
| 440 FROM_HERE, callback.callback(), time_period); | 440 FROM_HERE, callback.callback(), time_period); |
| 441 | 441 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 kAnnouncePacketRegistered, sizeof(kAnnouncePacketRegistered)); | 562 kAnnouncePacketRegistered, sizeof(kAnnouncePacketRegistered)); |
| 563 | 563 |
| 564 base::MessageLoop::current()->RunUntilIdle(); | 564 base::MessageLoop::current()->RunUntilIdle(); |
| 565 | 565 |
| 566 EXPECT_TRUE(WebUIBrowserTest::RunJavascriptTest("expectRegisterDone")); | 566 EXPECT_TRUE(WebUIBrowserTest::RunJavascriptTest("expectRegisterDone")); |
| 567 } | 567 } |
| 568 | 568 |
| 569 } // namespace | 569 } // namespace |
| 570 | 570 |
| 571 } // namespace local_discovery | 571 } // namespace local_discovery |
| OLD | NEW |