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 base::Unretained(this)); | 338 base::Unretained(this)); |
339 } | 339 } |
340 }; | 340 }; |
341 | 341 |
342 class LocalDiscoveryUITest : public WebUIBrowserTest { | 342 class LocalDiscoveryUITest : public WebUIBrowserTest { |
343 public: | 343 public: |
344 LocalDiscoveryUITest() : fake_fetcher_factory_( | 344 LocalDiscoveryUITest() : fake_fetcher_factory_( |
345 &fetcher_impl_factory_, | 345 &fetcher_impl_factory_, |
346 fake_url_fetcher_creator_.callback()) { | 346 fake_url_fetcher_creator_.callback()) { |
347 } | 347 } |
348 virtual ~LocalDiscoveryUITest() { | 348 ~LocalDiscoveryUITest() override { |
349 } | 349 } |
350 | 350 |
351 virtual void SetUpOnMainThread() override { | 351 void SetUpOnMainThread() override { |
352 WebUIBrowserTest::SetUpOnMainThread(); | 352 WebUIBrowserTest::SetUpOnMainThread(); |
353 | 353 |
354 test_service_discovery_client_ = new TestServiceDiscoveryClient(); | 354 test_service_discovery_client_ = new TestServiceDiscoveryClient(); |
355 test_service_discovery_client_->Start(); | 355 test_service_discovery_client_->Start(); |
356 EXPECT_CALL( | 356 EXPECT_CALL( |
357 *test_service_discovery_client_.get(), | 357 *test_service_discovery_client_.get(), |
358 OnSendTo(std::string((const char*)kQueryData, sizeof(kQueryData)))) | 358 OnSendTo(std::string((const char*)kQueryData, sizeof(kQueryData)))) |
359 .Times(AtLeast(2)) | 359 .Times(AtLeast(2)) |
360 .WillOnce(InvokeWithoutArgs(&condition_devices_listed_, | 360 .WillOnce(InvokeWithoutArgs(&condition_devices_listed_, |
361 &TestMessageLoopCondition::Signal)) | 361 &TestMessageLoopCondition::Signal)) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 .Times(AnyNumber()); | 418 .Times(AnyNumber()); |
419 | 419 |
420 ProfileOAuth2TokenService* token_service = | 420 ProfileOAuth2TokenService* token_service = |
421 ProfileOAuth2TokenServiceFactory::GetForProfile(browser()->profile()); | 421 ProfileOAuth2TokenServiceFactory::GetForProfile(browser()->profile()); |
422 | 422 |
423 token_service->UpdateCredentials("user@host.com", "MyFakeToken"); | 423 token_service->UpdateCredentials("user@host.com", "MyFakeToken"); |
424 | 424 |
425 AddLibrary(base::FilePath(FILE_PATH_LITERAL("local_discovery_ui_test.js"))); | 425 AddLibrary(base::FilePath(FILE_PATH_LITERAL("local_discovery_ui_test.js"))); |
426 } | 426 } |
427 | 427 |
428 virtual void SetUpCommandLine(base::CommandLine* command_line) override { | 428 void SetUpCommandLine(base::CommandLine* command_line) override { |
429 #if defined(OS_CHROMEOS) | 429 #if defined(OS_CHROMEOS) |
430 // On chromeos, don't sign in with the stub-user automatically. Use the | 430 // On chromeos, don't sign in with the stub-user automatically. Use the |
431 // kLoginUser instead. | 431 // kLoginUser instead. |
432 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser, | 432 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser, |
433 kSampleUser); | 433 kSampleUser); |
434 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, | 434 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, |
435 chrome::kTestUserProfileDir); | 435 chrome::kTestUserProfileDir); |
436 #endif | 436 #endif |
437 WebUIBrowserTest::SetUpCommandLine(command_line); | 437 WebUIBrowserTest::SetUpCommandLine(command_line); |
438 } | 438 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 kAnnouncePacketRegistered, sizeof(kAnnouncePacketRegistered)); | 567 kAnnouncePacketRegistered, sizeof(kAnnouncePacketRegistered)); |
568 | 568 |
569 base::MessageLoop::current()->RunUntilIdle(); | 569 base::MessageLoop::current()->RunUntilIdle(); |
570 | 570 |
571 EXPECT_TRUE(WebUIBrowserTest::RunJavascriptTest("expectRegisterDone")); | 571 EXPECT_TRUE(WebUIBrowserTest::RunJavascriptTest("expectRegisterDone")); |
572 } | 572 } |
573 | 573 |
574 } // namespace | 574 } // namespace |
575 | 575 |
576 } // namespace local_discovery | 576 } // namespace local_discovery |
OLD | NEW |