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

Unified Diff: services/shell/public/cpp/lib/service_test.cc

Issue 2419723002: Move services/shell to services/service_manager (Closed)
Patch Set: rebase Created 4 years, 2 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 | « services/shell/public/cpp/lib/service_runner.cc ('k') | services/shell/public/cpp/names.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/shell/public/cpp/lib/service_test.cc
diff --git a/services/shell/public/cpp/lib/service_test.cc b/services/shell/public/cpp/lib/service_test.cc
deleted file mode 100644
index 3a6cf6622e218398399947ab7479e42724cb924d..0000000000000000000000000000000000000000
--- a/services/shell/public/cpp/lib/service_test.cc
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "services/shell/public/cpp/service_test.h"
-
-#include "base/memory/ptr_util.h"
-#include "base/message_loop/message_loop.h"
-#include "base/run_loop.h"
-#include "services/shell/background/background_shell.h"
-#include "services/shell/public/cpp/service.h"
-
-namespace shell {
-namespace test {
-
-ServiceTestClient::ServiceTestClient(ServiceTest* test) : test_(test) {}
-ServiceTestClient::~ServiceTestClient() {}
-
-void ServiceTestClient::OnStart(const Identity& identity) {
- test_->OnStartCalled(connector(), identity.name(),
- identity.user_id());
-}
-
-ServiceTest::ServiceTest() {}
-ServiceTest::ServiceTest(const std::string& test_name)
- : test_name_(test_name) {}
-ServiceTest::~ServiceTest() {}
-
-void ServiceTest::InitTestName(const std::string& test_name) {
- DCHECK(test_name_.empty());
- test_name_ = test_name;
-}
-
-std::unique_ptr<Service> ServiceTest::CreateService() {
- return base::WrapUnique(new ServiceTestClient(this));
-}
-
-std::unique_ptr<base::MessageLoop> ServiceTest::CreateMessageLoop() {
- return base::WrapUnique(new base::MessageLoop);
-}
-
-void ServiceTest::OnStartCalled(Connector* connector,
- const std::string& name,
- const std::string& user_id) {
- DCHECK_EQ(connector_, connector);
- initialize_name_ = name;
- initialize_userid_ = user_id;
- initialize_called_.Run();
-}
-
-void ServiceTest::SetUp() {
- service_ = CreateService();
- message_loop_ = CreateMessageLoop();
- background_shell_.reset(new shell::BackgroundShell);
- background_shell_->Init(nullptr);
-
- // Create the shell connection. We don't proceed until we get our
- // Service's OnStart() method is called.
- base::RunLoop run_loop;
- base::MessageLoop::ScopedNestableTaskAllower allow(
- base::MessageLoop::current());
- initialize_called_ = run_loop.QuitClosure();
-
- service_->set_context(base::MakeUnique<ServiceContext>(
- service_.get(), background_shell_->CreateServiceRequest(test_name_)));
- connector_ = service_->connector();
-
- run_loop.Run();
-}
-
-void ServiceTest::TearDown() {
- background_shell_.reset();
- message_loop_.reset();
- service_.reset();
-}
-
-} // namespace test
-} // namespace shell
« no previous file with comments | « services/shell/public/cpp/lib/service_runner.cc ('k') | services/shell/public/cpp/names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698