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

Unified Diff: shell/application_manager/application_manager_unittest.cc

Issue 858273002: De-client shell/application_manager/test.mojom (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | « no previous file | shell/application_manager/test.mojom » ('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 f1a09cd06efcf64bd604e44978850c455aa34c38..6c0150570781741779e0881f7be19d8523960326 100644
--- a/shell/application_manager/application_manager_unittest.cc
+++ b/shell/application_manager/application_manager_unittest.cc
@@ -61,38 +61,38 @@ class TestServiceImpl : public InterfaceImpl<TestService> {
}
// TestService implementation:
- void Test(const String& test_string) override {
+ void Test(const String& test_string,
+ const mojo::Callback<void()>& callback) override {
context_->last_test_string = test_string;
- client()->AckTest();
+ callback.Run();
}
private:
TestContext* context_;
};
-class TestClientImpl : public TestClient {
+class TestClient {
public:
- explicit TestClientImpl(TestServicePtr service)
- : service_(service.Pass()), quit_after_ack_(false) {
- service_.set_client(this);
- }
+ explicit TestClient(TestServicePtr service)
+ : service_(service.Pass()), quit_after_ack_(false) {}
- ~TestClientImpl() override { service_.reset(); }
+ ~TestClient() { service_.reset(); }
- void AckTest() override {
+ void AckTest() {
if (quit_after_ack_)
base::MessageLoop::current()->Quit();
}
void Test(const std::string& test_string) {
quit_after_ack_ = true;
- service_->Test(test_string);
+ service_->Test(test_string,
+ base::Bind(&TestClient::AckTest, base::Unretained(this)));
}
private:
TestServicePtr service_;
bool quit_after_ack_;
- DISALLOW_COPY_AND_ASSIGN(TestClientImpl);
+ DISALLOW_COPY_AND_ASSIGN(TestClient);
};
class TestApplicationLoader : public ApplicationLoader,
@@ -421,7 +421,7 @@ class ApplicationManagerTest : public testing::Test {
TestServicePtr service_proxy;
application_manager_->ConnectToService(GURL(kTestURLString),
&service_proxy);
- test_client_.reset(new TestClientImpl(service_proxy.Pass()));
+ test_client_.reset(new TestClient(service_proxy.Pass()));
}
void TearDown() override {
@@ -446,7 +446,7 @@ class ApplicationManagerTest : public testing::Test {
TesterContext tester_context_;
TestContext context_;
base::MessageLoop loop_;
- scoped_ptr<TestClientImpl> test_client_;
+ scoped_ptr<TestClient> test_client_;
scoped_ptr<ApplicationManager> application_manager_;
DISALLOW_COPY_AND_ASSIGN(ApplicationManagerTest);
};
@@ -466,7 +466,7 @@ TEST_F(ApplicationManagerTest, NoArgs) {
am.SetLoaderForURL(scoped_ptr<ApplicationLoader>(loader), test_url);
TestServicePtr test_service;
am.ConnectToService(test_url, &test_service);
- TestClientImpl test_client(test_service.Pass());
+ TestClient test_client(test_service.Pass());
test_client.Test("test");
loop_.Run();
std::vector<std::string> app_args = loader->GetArgs();
@@ -486,7 +486,7 @@ TEST_F(ApplicationManagerTest, Args) {
am.SetLoaderForURL(scoped_ptr<ApplicationLoader>(loader), test_url);
TestServicePtr test_service;
am.ConnectToService(test_url, &test_service);
- TestClientImpl test_client(test_service.Pass());
+ TestClient test_client(test_service.Pass());
test_client.Test("test");
loop_.Run();
std::vector<std::string> app_args = loader->GetArgs();
« no previous file with comments | « no previous file | shell/application_manager/test.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698