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

Unified Diff: mojo/shell/tests/application_manager_unittest.cc

Issue 1714753002: 7/ Eliminate on_application_end from ConnectParams (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@client_request
Patch Set: . Created 4 years, 10 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
Index: mojo/shell/tests/application_manager_unittest.cc
diff --git a/mojo/shell/tests/application_manager_unittest.cc b/mojo/shell/tests/application_manager_unittest.cc
index 3689df5071258c21f6aadee1958dfbd502e337bd..ac4133d9614d879401e6107be9a589458f94225d 100644
--- a/mojo/shell/tests/application_manager_unittest.cc
+++ b/mojo/shell/tests/application_manager_unittest.cc
@@ -37,9 +37,13 @@ struct TestContext {
int num_loader_deletes;
};
-void QuitClosure(bool* value) {
- *value = true;
- base::MessageLoop::current()->QuitWhenIdle();
+void QuitClosure(const Identity& expected,
+ bool* value,
+ const Identity& actual) {
+ if (expected == actual) {
+ *value = true;
+ base::MessageLoop::current()->QuitWhenIdle();
+ }
}
class TestServiceImpl : public TestService {
@@ -382,10 +386,10 @@ class Tester : public ShellClient,
ScopedVector<TestAImpl> a_bindings_;
};
-void OnConnect(base::RunLoop* loop, uint32_t instance_id) {
- loop->Quit();
-}
-
+void OnConnect(base::RunLoop* loop, uint32_t instance_id) {
+ loop->Quit();
+}
+
class ApplicationManagerTest : public testing::Test {
public:
ApplicationManagerTest() : tester_context_(&loop_) {}
@@ -399,7 +403,7 @@ class ApplicationManagerTest : public testing::Test {
scoped_ptr<ApplicationLoader>(test_loader_));
TestServicePtr service_proxy;
- ConnectToInterface(GURL(kTestURLString), &service_proxy);
+ ConnectToInterface(GURL(kTestURLString), &service_proxy);
test_client_.reset(new TestClient(std::move(service_proxy)));
}
@@ -501,9 +505,9 @@ TEST_F(ApplicationManagerTest, SetLoaders) {
// Confirm that the url of a service is correctly passed to another service that
// it loads.
-// TODO(beng): these tests are disabled due to the new async connect flow.
-// they should be re-written as shell apptests.
-TEST_F(ApplicationManagerTest, DISABLED_ACallB) {
+// TODO(beng): these tests are disabled due to the new async connect flow.
+// they should be re-written as shell apptests.
+TEST_F(ApplicationManagerTest, DISABLED_ACallB) {
// Any url can load a.
AddLoaderForURL(GURL(kTestAURLString), std::string());
@@ -597,8 +601,8 @@ TEST_F(ApplicationManagerTest, TestEndApplicationClosure) {
bool called = false;
scoped_ptr<ConnectParams> params(new ConnectParams);
params->SetTargetURL(GURL("test:test"));
- params->set_on_application_end(
- base::Bind(&QuitClosure, base::Unretained(&called)));
+ application_manager_->SetInstanceQuitCallback(
+ base::Bind(&QuitClosure, params->target(), &called));
application_manager_->Connect(std::move(params));
loop_.Run();
EXPECT_TRUE(called);

Powered by Google App Engine
This is Rietveld 408576698