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

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

Issue 2123363002: ShellTest -> ServiceTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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_test.cc ('k') | services/shell/public/cpp/service_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/shell/public/cpp/lib/shell_test.cc
diff --git a/services/shell/public/cpp/lib/shell_test.cc b/services/shell/public/cpp/lib/shell_test.cc
deleted file mode 100644
index 6f4f1a7c0126a663408035482f54947abe187170..0000000000000000000000000000000000000000
--- a/services/shell/public/cpp/lib/shell_test.cc
+++ /dev/null
@@ -1,81 +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/shell_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 {
-
-ShellTestClient::ShellTestClient(ShellTest* test) : test_(test) {}
-ShellTestClient::~ShellTestClient() {}
-
-void ShellTestClient::OnStart(Connector* connector, const Identity& identity,
- uint32_t id) {
- test_->OnStartCalled(connector, identity.name(), identity.user_id(), id);
-}
-
-ShellTest::ShellTest() {}
-ShellTest::ShellTest(const std::string& test_name) : test_name_(test_name) {}
-ShellTest::~ShellTest() {}
-
-void ShellTest::InitTestName(const std::string& test_name) {
- DCHECK(test_name_.empty());
- test_name_ = test_name;
-}
-
-std::unique_ptr<Service> ShellTest::CreateService() {
- return base::WrapUnique(new ShellTestClient(this));
-}
-
-std::unique_ptr<base::MessageLoop> ShellTest::CreateMessageLoop() {
- return base::WrapUnique(new base::MessageLoop);
-}
-
-void ShellTest::OnStartCalled(Connector* connector,
- const std::string& name,
- const std::string& user_id,
- uint32_t id) {
- DCHECK_EQ(connector_, connector);
- initialize_name_ = name;
- initialize_instance_id_ = id;
- initialize_userid_ = user_id;
- initialize_called_.Run();
-}
-
-void ShellTest::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();
-
- shell_connection_.reset(new ShellConnection(
- service_.get(),
- background_shell_->CreateServiceRequest(test_name_)));
- connector_ = shell_connection_->connector();
-
- run_loop.Run();
-}
-
-void ShellTest::TearDown() {
- shell_connection_.reset();
- background_shell_.reset();
- message_loop_.reset();
- service_.reset();
-}
-
-} // namespace test
-} // namespace shell
« no previous file with comments | « services/shell/public/cpp/lib/service_test.cc ('k') | services/shell/public/cpp/service_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698