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 std::vector<std::string> GetArgs() { | 111 const std::vector<std::string>& GetArgs() { return test_app_->args(); } |
viettrungluu
2014/10/16 22:47:19
This method should be const.
| |
112 return test_app_->args().To<std::vector<std::string> >(); | |
113 } | |
114 | 112 |
115 private: | 113 private: |
116 // ApplicationLoader implementation. | 114 // ApplicationLoader implementation. |
117 virtual void Load(ApplicationManager* manager, | 115 virtual void Load(ApplicationManager* manager, |
118 const GURL& url, | 116 const GURL& url, |
119 scoped_refptr<LoadCallbacks> callbacks) override { | 117 scoped_refptr<LoadCallbacks> callbacks) override { |
120 ++num_loads_; | 118 ++num_loads_; |
121 test_app_.reset( | 119 test_app_.reset( |
122 new ApplicationImpl(this, callbacks->RegisterApplication().Pass())); | 120 new ApplicationImpl(this, callbacks->RegisterApplication().Pass())); |
123 } | 121 } |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
677 std::string url("test:test3"); | 675 std::string url("test:test3"); |
678 TestServicePtr test_service; | 676 TestServicePtr test_service; |
679 application_manager_->ConnectToService(GURL(url), &test_service); | 677 application_manager_->ConnectToService(GURL(url), &test_service); |
680 | 678 |
681 EXPECT_EQ(1, interceptor.call_count()); | 679 EXPECT_EQ(1, interceptor.call_count()); |
682 EXPECT_EQ(url, interceptor.url_spec()); | 680 EXPECT_EQ(url, interceptor.url_spec()); |
683 EXPECT_EQ(1, default_loader->num_loads()); | 681 EXPECT_EQ(1, default_loader->num_loads()); |
684 } | 682 } |
685 | 683 |
686 } // namespace mojo | 684 } // namespace mojo |
OLD | NEW |