Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(698)

Unified Diff: mojo/shell/capability_filter_unittest.cc

Issue 1254383016: ApplicationConnection lifetime management changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/shell/application_manager_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/capability_filter_unittest.cc
diff --git a/mojo/shell/capability_filter_unittest.cc b/mojo/shell/capability_filter_unittest.cc
index 688815f165007ca3a805ab3673e9cc0517c67d19..fda2c314d3044660ea7270d9368239f3495c38fc 100644
--- a/mojo/shell/capability_filter_unittest.cc
+++ b/mojo/shell/capability_filter_unittest.cc
@@ -115,8 +115,8 @@ class ConnectionValidator : public ApplicationLoader,
// set of interfaces exposed by that service.
class TestApplication : public ApplicationDelegate {
public:
- TestApplication() : app_(nullptr) {}
- ~TestApplication() override {}
+ TestApplication() : app_(nullptr) {}
+ ~TestApplication() override {}
private:
// Overridden from ApplicationDelegate:
@@ -129,17 +129,15 @@ class TestApplication : public ApplicationDelegate {
URLRequestPtr request(URLRequest::New());
request->url = String::From("test:service");
- ApplicationConnection* connection1 =
- app_->ConnectToApplication(request.Pass());
- connection1->SetRemoteServiceProviderConnectionErrorHandler(
+ connection1_ = app_->ConnectToApplication(request.Pass());
+ connection1_->SetRemoteServiceProviderConnectionErrorHandler(
base::Bind(&TestApplication::ConnectionClosed,
base::Unretained(this), "test:service"));
URLRequestPtr request2(URLRequest::New());
request2->url = String::From("test:service2");
- ApplicationConnection* connection2 =
- app_->ConnectToApplication(request2.Pass());
- connection2->SetRemoteServiceProviderConnectionErrorHandler(
+ connection2_ = app_->ConnectToApplication(request2.Pass());
+ connection2_->SetRemoteServiceProviderConnectionErrorHandler(
base::Bind(&TestApplication::ConnectionClosed,
base::Unretained(this), "test:service2"));
return true;
@@ -151,6 +149,8 @@ class TestApplication : public ApplicationDelegate {
ApplicationImpl* app_;
ValidatorPtr validator_;
+ scoped_ptr<ApplicationConnection> connection1_;
+ scoped_ptr<ApplicationConnection> connection2_;
DISALLOW_COPY_AND_ASSIGN(TestApplication);
};
@@ -181,12 +181,15 @@ class TestContentHandler : public ApplicationDelegate,
// Overridden from ContentHandler:
void StartApplication(InterfaceRequest<Application> application,
URLResponsePtr response) override {
+ scoped_ptr<ApplicationDelegate> delegate(new TestApplication);
embedded_apps_.push_back(
- new ApplicationImpl(new TestApplication, application.Pass()));
+ new ApplicationImpl(delegate.get(), application.Pass()));
+ embedded_app_delegates_.push_back(delegate.Pass());
}
ApplicationImpl* app_;
WeakBindingSet<ContentHandler> bindings_;
+ ScopedVector<ApplicationDelegate> embedded_app_delegates_;
ScopedVector<ApplicationImpl> embedded_apps_;
DISALLOW_COPY_AND_ASSIGN(TestContentHandler);
« no previous file with comments | « mojo/shell/application_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698