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

Unified Diff: shell/application_manager/application_manager_unittest.cc

Issue 1074963002: Add some |using mojo::...;|s to //shell .cc files. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 8 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.cc » ('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 099728f12c0f2e5b07f33f1fc70139b2f1bda812..25c373ab8dedf2e27d92a705f7707eaf03b3b759 100644
--- a/shell/application_manager/application_manager_unittest.cc
+++ b/shell/application_manager/application_manager_unittest.cc
@@ -18,6 +18,15 @@
#include "shell/application_manager/test.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
+using mojo::Application;
+using mojo::ApplicationConnection;
+using mojo::ApplicationDelegate;
+using mojo::ApplicationImpl;
+using mojo::Callback;
+using mojo::InterfaceFactory;
+using mojo::InterfaceRequest;
+using mojo::StrongBinding;
+
namespace shell {
namespace {
@@ -53,8 +62,7 @@ class QuitMessageLoopErrorHandler : public mojo::ErrorHandler {
class TestServiceImpl : public TestService {
public:
- TestServiceImpl(TestContext* context,
- mojo::InterfaceRequest<TestService> request)
+ TestServiceImpl(TestContext* context, InterfaceRequest<TestService> request)
: context_(context), binding_(this, request.Pass()) {
++context_->num_impls;
}
@@ -68,14 +76,14 @@ class TestServiceImpl : public TestService {
// TestService implementation:
void Test(const mojo::String& test_string,
- const mojo::Callback<void()>& callback) override {
+ const Callback<void()>& callback) override {
context_->last_test_string = test_string;
callback.Run();
}
private:
TestContext* context_;
- mojo::StrongBinding<TestService> binding_;
+ StrongBinding<TestService> binding_;
};
class TestClient {
@@ -101,8 +109,8 @@ class TestClient {
};
class TestApplicationLoader : public ApplicationLoader,
- public mojo::ApplicationDelegate,
- public mojo::InterfaceFactory<TestService> {
+ public ApplicationDelegate,
+ public InterfaceFactory<TestService> {
public:
TestApplicationLoader() : context_(nullptr), num_loads_(0) {}
@@ -118,28 +126,25 @@ class TestApplicationLoader : public ApplicationLoader,
private:
// ApplicationLoader implementation.
- void Load(
- const GURL& url,
- mojo::InterfaceRequest<mojo::Application> application_request) override {
+ void Load(const GURL& url,
+ InterfaceRequest<Application> application_request) override {
++num_loads_;
- test_app_.reset(
- new mojo::ApplicationImpl(this, application_request.Pass()));
+ test_app_.reset(new ApplicationImpl(this, application_request.Pass()));
}
- // mojo::ApplicationDelegate implementation.
- bool ConfigureIncomingConnection(
- mojo::ApplicationConnection* connection) override {
+ // ApplicationDelegate implementation.
+ bool ConfigureIncomingConnection(ApplicationConnection* connection) override {
connection->AddService(this);
return true;
}
- // mojo::InterfaceFactory implementation.
- void Create(mojo::ApplicationConnection* connection,
- mojo::InterfaceRequest<TestService> request) override {
+ // InterfaceFactory implementation.
+ void Create(ApplicationConnection* connection,
+ InterfaceRequest<TestService> request) override {
new TestServiceImpl(context_, request.Pass());
}
- scoped_ptr<mojo::ApplicationImpl> test_app_;
+ scoped_ptr<ApplicationImpl> test_app_;
TestContext* context_;
int num_loads_;
DISALLOW_COPY_AND_ASSIGN(TestApplicationLoader);
@@ -148,9 +153,8 @@ class TestApplicationLoader : public ApplicationLoader,
class ClosingApplicationLoader : public ApplicationLoader {
private:
// ApplicationLoader implementation.
- void Load(
- const GURL& url,
- mojo::InterfaceRequest<mojo::Application> application_request) override {}
+ void Load(const GURL& url,
+ InterfaceRequest<Application> application_request) override {}
};
class TesterContext {
@@ -251,9 +255,9 @@ class TesterContext {
// Used to test that the requestor url will be correctly passed.
class TestAImpl : public TestA {
public:
- TestAImpl(mojo::ApplicationImpl* app_impl,
+ TestAImpl(ApplicationImpl* app_impl,
TesterContext* test_context,
- mojo::InterfaceRequest<TestA> request)
+ InterfaceRequest<TestA> request)
: test_context_(test_context), binding_(this, request.Pass()) {
app_impl->ConnectToApplication(kTestBURLString)->ConnectToService(&b_);
}
@@ -281,14 +285,14 @@ class TestAImpl : public TestA {
TesterContext* test_context_;
TestBPtr b_;
- mojo::StrongBinding<TestA> binding_;
+ StrongBinding<TestA> binding_;
};
class TestBImpl : public TestB {
public:
- TestBImpl(mojo::ApplicationConnection* connection,
+ TestBImpl(ApplicationConnection* connection,
TesterContext* test_context,
- mojo::InterfaceRequest<TestB> request)
+ InterfaceRequest<TestB> request)
: test_context_(test_context), binding_(this, request.Pass()) {
connection->ConnectToService(&c_);
}
@@ -301,59 +305,57 @@ class TestBImpl : public TestB {
}
private:
- void B(const mojo::Callback<void()>& callback) override {
+ void B(const Callback<void()>& callback) override {
test_context_->IncrementNumBCalls();
callback.Run();
}
- void CallC(const mojo::Callback<void()>& callback) override {
+ void CallC(const Callback<void()>& callback) override {
test_context_->IncrementNumBCalls();
c_->C(callback);
}
TesterContext* test_context_;
TestCPtr c_;
- mojo::StrongBinding<TestB> binding_;
+ StrongBinding<TestB> binding_;
};
class TestCImpl : public TestC {
public:
- TestCImpl(mojo::ApplicationConnection* connection,
+ TestCImpl(ApplicationConnection* connection,
TesterContext* test_context,
- mojo::InterfaceRequest<TestC> request)
+ InterfaceRequest<TestC> request)
: test_context_(test_context), binding_(this, request.Pass()) {}
~TestCImpl() override { test_context_->IncrementNumCDeletes(); }
private:
- void C(const mojo::Callback<void()>& callback) override {
+ void C(const Callback<void()>& callback) override {
test_context_->IncrementNumCCalls();
callback.Run();
}
TesterContext* test_context_;
- mojo::StrongBinding<TestC> binding_;
+ StrongBinding<TestC> binding_;
};
-class Tester : public mojo::ApplicationDelegate,
+class Tester : public ApplicationDelegate,
public ApplicationLoader,
- public mojo::InterfaceFactory<TestA>,
- public mojo::InterfaceFactory<TestB>,
- public mojo::InterfaceFactory<TestC> {
+ public InterfaceFactory<TestA>,
+ public InterfaceFactory<TestB>,
+ public InterfaceFactory<TestC> {
public:
Tester(TesterContext* context, const std::string& requestor_url)
: context_(context), requestor_url_(requestor_url) {}
~Tester() override {}
private:
- void Load(
- const GURL& url,
- mojo::InterfaceRequest<mojo::Application> application_request) override {
- app_.reset(new mojo::ApplicationImpl(this, application_request.Pass()));
+ void Load(const GURL& url,
+ InterfaceRequest<Application> application_request) override {
+ app_.reset(new ApplicationImpl(this, application_request.Pass()));
}
- bool ConfigureIncomingConnection(
- mojo::ApplicationConnection* connection) override {
+ bool ConfigureIncomingConnection(ApplicationConnection* connection) override {
if (!requestor_url_.empty() &&
requestor_url_ != connection->GetRemoteApplicationURL()) {
context_->set_tester_called_quit();
@@ -369,31 +371,30 @@ class Tester : public mojo::ApplicationDelegate,
return true;
}
- bool ConfigureOutgoingConnection(
- mojo::ApplicationConnection* connection) override {
+ bool ConfigureOutgoingConnection(ApplicationConnection* connection) override {
// If we're connecting to B, then add C.
if (connection->GetRemoteApplicationURL() == kTestBURLString)
connection->AddService<TestC>(this);
return true;
}
- void Create(mojo::ApplicationConnection* connection,
- mojo::InterfaceRequest<TestA> request) override {
+ void Create(ApplicationConnection* connection,
+ InterfaceRequest<TestA> request) override {
a_bindings_.push_back(new TestAImpl(app_.get(), context_, request.Pass()));
}
- void Create(mojo::ApplicationConnection* connection,
- mojo::InterfaceRequest<TestB> request) override {
+ void Create(ApplicationConnection* connection,
+ InterfaceRequest<TestB> request) override {
new TestBImpl(connection, context_, request.Pass());
}
- void Create(mojo::ApplicationConnection* connection,
- mojo::InterfaceRequest<TestC> request) override {
+ void Create(ApplicationConnection* connection,
+ InterfaceRequest<TestC> request) override {
new TestCImpl(connection, context_, request.Pass());
}
TesterContext* context_;
- scoped_ptr<mojo::ApplicationImpl> app_;
+ scoped_ptr<ApplicationImpl> app_;
std::string requestor_url_;
ScopedVector<TestAImpl> a_bindings_;
};
@@ -426,17 +427,16 @@ class TestDelegate : public ApplicationManager::Delegate {
std::map<GURL, GURL> mappings_;
};
-class TestExternal : public mojo::ApplicationDelegate {
+class TestExternal : public ApplicationDelegate {
public:
TestExternal() : configure_incoming_connection_called_(false) {}
- void Initialize(mojo::ApplicationImpl* app) override {
+ void Initialize(ApplicationImpl* app) override {
initialize_args_ = app->args();
base::MessageLoop::current()->Quit();
}
- bool ConfigureIncomingConnection(
- mojo::ApplicationConnection* connection) override {
+ bool ConfigureIncomingConnection(ApplicationConnection* connection) override {
configure_incoming_connection_called_ = true;
base::MessageLoop::current()->Quit();
return true;
« no previous file with comments | « shell/application_manager/application_manager.cc ('k') | shell/application_manager/shell_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698