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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 TestApplicationLoader() : context_(NULL), num_loads_(0) {} | 101 TestApplicationLoader() : context_(NULL), num_loads_(0) {} |
102 | 102 |
103 virtual ~TestApplicationLoader() { | 103 virtual ~TestApplicationLoader() { |
104 if (context_) | 104 if (context_) |
105 ++context_->num_loader_deletes; | 105 ++context_->num_loader_deletes; |
106 test_app_.reset(NULL); | 106 test_app_.reset(NULL); |
107 } | 107 } |
108 | 108 |
109 void set_context(TestContext* context) { context_ = context; } | 109 void set_context(TestContext* context) { context_ = context; } |
110 int num_loads() const { return num_loads_; } | 110 int num_loads() const { return num_loads_; } |
111 const std::vector<std::string>& GetArgs() { return test_app_->args(); } | 111 const std::vector<std::string>& GetArgs() const { return test_app_->args(); } |
112 | 112 |
113 private: | 113 private: |
114 // ApplicationLoader implementation. | 114 // ApplicationLoader implementation. |
115 virtual void Load(ApplicationManager* manager, | 115 virtual void Load(ApplicationManager* manager, |
116 const GURL& url, | 116 const GURL& url, |
117 scoped_refptr<LoadCallbacks> callbacks) override { | 117 scoped_refptr<LoadCallbacks> callbacks) override { |
118 ++num_loads_; | 118 ++num_loads_; |
119 test_app_.reset( | 119 test_app_.reset( |
120 new ApplicationImpl(this, callbacks->RegisterApplication().Pass())); | 120 new ApplicationImpl(this, callbacks->RegisterApplication().Pass())); |
121 } | 121 } |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 std::string url("test:test3"); | 674 std::string url("test:test3"); |
675 TestServicePtr test_service; | 675 TestServicePtr test_service; |
676 application_manager_->ConnectToService(GURL(url), &test_service); | 676 application_manager_->ConnectToService(GURL(url), &test_service); |
677 | 677 |
678 EXPECT_EQ(1, interceptor.call_count()); | 678 EXPECT_EQ(1, interceptor.call_count()); |
679 EXPECT_EQ(url, interceptor.url_spec()); | 679 EXPECT_EQ(url, interceptor.url_spec()); |
680 EXPECT_EQ(1, default_loader->num_loads()); | 680 EXPECT_EQ(1, default_loader->num_loads()); |
681 } | 681 } |
682 | 682 |
683 } // namespace mojo | 683 } // namespace mojo |
OLD | NEW |