OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "mojo/application_manager/application_loader.h" | 9 #include "mojo/application_manager/application_loader.h" |
10 #include "mojo/application_manager/application_manager.h" | 10 #include "mojo/application_manager/application_manager.h" |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 GURL url_; | 401 GURL url_; |
402 DISALLOW_COPY_AND_ASSIGN(TestServiceInterceptor); | 402 DISALLOW_COPY_AND_ASSIGN(TestServiceInterceptor); |
403 }; | 403 }; |
404 | 404 |
405 } // namespace | 405 } // namespace |
406 | 406 |
407 class ApplicationManagerTest : public testing::Test { | 407 class ApplicationManagerTest : public testing::Test { |
408 public: | 408 public: |
409 ApplicationManagerTest() : tester_context_(&loop_) {} | 409 ApplicationManagerTest() : tester_context_(&loop_) {} |
410 | 410 |
411 virtual ~ApplicationManagerTest() {} | 411 ~ApplicationManagerTest() override {} |
412 | 412 |
413 virtual void SetUp() override { | 413 void SetUp() override { |
414 application_manager_.reset(new ApplicationManager); | 414 application_manager_.reset(new ApplicationManager); |
415 TestApplicationLoader* default_loader = new TestApplicationLoader; | 415 TestApplicationLoader* default_loader = new TestApplicationLoader; |
416 default_loader->set_context(&context_); | 416 default_loader->set_context(&context_); |
417 application_manager_->set_default_loader( | 417 application_manager_->set_default_loader( |
418 scoped_ptr<ApplicationLoader>(default_loader)); | 418 scoped_ptr<ApplicationLoader>(default_loader)); |
419 | 419 |
420 TestServicePtr service_proxy; | 420 TestServicePtr service_proxy; |
421 application_manager_->ConnectToService(GURL(kTestURLString), | 421 application_manager_->ConnectToService(GURL(kTestURLString), |
422 &service_proxy); | 422 &service_proxy); |
423 test_client_.reset(new TestClientImpl(service_proxy.Pass())); | 423 test_client_.reset(new TestClientImpl(service_proxy.Pass())); |
424 } | 424 } |
425 | 425 |
426 virtual void TearDown() override { | 426 void TearDown() override { |
427 test_client_.reset(NULL); | 427 test_client_.reset(NULL); |
428 application_manager_.reset(NULL); | 428 application_manager_.reset(NULL); |
429 } | 429 } |
430 | 430 |
431 scoped_ptr<BackgroundShellApplicationLoader> MakeLoader( | 431 scoped_ptr<BackgroundShellApplicationLoader> MakeLoader( |
432 const std::string& requestor_url) { | 432 const std::string& requestor_url) { |
433 scoped_ptr<ApplicationLoader> real_loader( | 433 scoped_ptr<ApplicationLoader> real_loader( |
434 new Tester(&tester_context_, requestor_url)); | 434 new Tester(&tester_context_, requestor_url)); |
435 scoped_ptr<BackgroundShellApplicationLoader> loader( | 435 scoped_ptr<BackgroundShellApplicationLoader> loader( |
436 new BackgroundShellApplicationLoader(real_loader.Pass(), | 436 new BackgroundShellApplicationLoader(real_loader.Pass(), |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 std::string url("test:test3"); | 671 std::string url("test:test3"); |
672 TestServicePtr test_service; | 672 TestServicePtr test_service; |
673 application_manager_->ConnectToService(GURL(url), &test_service); | 673 application_manager_->ConnectToService(GURL(url), &test_service); |
674 | 674 |
675 EXPECT_EQ(1, interceptor.call_count()); | 675 EXPECT_EQ(1, interceptor.call_count()); |
676 EXPECT_EQ(url, interceptor.url_spec()); | 676 EXPECT_EQ(url, interceptor.url_spec()); |
677 EXPECT_EQ(1, default_loader->num_loads()); | 677 EXPECT_EQ(1, default_loader->num_loads()); |
678 } | 678 } |
679 | 679 |
680 } // namespace mojo | 680 } // namespace mojo |
OLD | NEW |