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

Unified Diff: shell/application_manager/application_manager_unittest.cc

Issue 983113002: ApplicationManager: Use callback to get notified on application shutdown. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase after parameters fix Created 5 years, 9 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 | « shell/application_manager/application_manager.cc ('k') | shell/application_manager/shell_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: shell/application_manager/application_manager_unittest.cc
diff --git a/shell/application_manager/application_manager_unittest.cc b/shell/application_manager/application_manager_unittest.cc
index 19edcff0bde63ac72381dc0d0c957a8289e7f62c..2e7c27903200075ee340adef729498fca466006c 100644
--- a/shell/application_manager/application_manager_unittest.cc
+++ b/shell/application_manager/application_manager_unittest.cc
@@ -33,6 +33,11 @@ struct TestContext {
int num_loader_deletes;
};
+void QuitClosure(bool* value) {
+ *value = true;
+ base::MessageLoop::current()->QuitWhenIdle();
+}
+
class QuitMessageLoopErrorHandler : public ErrorHandler {
public:
QuitMessageLoopErrorHandler() {}
@@ -137,6 +142,13 @@ class TestApplicationLoader : public ApplicationLoader,
DISALLOW_COPY_AND_ASSIGN(TestApplicationLoader);
};
+class ClosingApplicationLoader : public ApplicationLoader {
+ private:
+ // ApplicationLoader implementation.
+ void Load(const GURL& url,
+ InterfaceRequest<Application> application_request) override {}
+};
+
class TesterContext {
public:
explicit TesterContext(base::MessageLoop* loop)
@@ -403,8 +415,6 @@ class TestDelegate : public ApplicationManager::Delegate {
return mapped_url;
}
- void OnApplicationError(const GURL& url) override {}
-
private:
std::map<GURL, GURL> mappings_;
};
@@ -801,6 +811,19 @@ TEST_F(ApplicationManagerTest, TestQueryWithLoaders) {
EXPECT_EQ(1, scheme_loader->num_loads());
}
+TEST_F(ApplicationManagerTest, TestEndApplicationClosure) {
+ ClosingApplicationLoader* loader = new ClosingApplicationLoader();
+ application_manager_->SetLoaderForScheme(
+ scoped_ptr<ApplicationLoader>(loader), "test");
+
+ bool called = false;
+ application_manager_->ConnectToApplication(
+ GURL("test:test"), GURL(), nullptr, nullptr,
+ base::Bind(&QuitClosure, base::Unretained(&called)));
+ loop_.Run();
+ EXPECT_TRUE(called);
+}
+
} // namespace
} // namespace shell
} // namespace mojo
« no previous file with comments | « shell/application_manager/application_manager.cc ('k') | shell/application_manager/shell_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698