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

Unified Diff: mojo/application/public/cpp/tests/service_registry_unittest.cc

Issue 1565343003: Move mojo/application/public -> mojo/shell/public (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fetcher
Patch Set: . Created 4 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 | « mojo/application/public/cpp/tests/BUILD.gn ('k') | mojo/application/public/interfaces/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/application/public/cpp/tests/service_registry_unittest.cc
diff --git a/mojo/application/public/cpp/tests/service_registry_unittest.cc b/mojo/application/public/cpp/tests/service_registry_unittest.cc
deleted file mode 100644
index 98ce637310a8a1c1a7c83450bb610ce7d9a15737..0000000000000000000000000000000000000000
--- a/mojo/application/public/cpp/tests/service_registry_unittest.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2014 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 "mojo/application/public/cpp/lib/service_registry.h"
-
-#include "base/memory/scoped_ptr.h"
-#include "mojo/application/public/cpp/service_connector.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace mojo {
-namespace internal {
-namespace {
-
-class TestConnector : public ServiceConnector {
- public:
- explicit TestConnector(int* delete_count) : delete_count_(delete_count) {}
- ~TestConnector() override { (*delete_count_)++; }
- void ConnectToService(ApplicationConnection* application_connection,
- const std::string& interface_name,
- ScopedMessagePipeHandle client_handle) override {}
-
- private:
- int* delete_count_;
-};
-
-TEST(ServiceRegistryTest, Ownership) {
- int delete_count = 0;
-
- // Destruction.
- {
- ServiceRegistry registry;
- registry.SetServiceConnectorForName(new TestConnector(&delete_count),
- "TC1");
- }
- EXPECT_EQ(1, delete_count);
-
- // Removal.
- {
- scoped_ptr<ServiceRegistry> registry(new ServiceRegistry);
- ServiceConnector* c = new TestConnector(&delete_count);
- registry->SetServiceConnectorForName(c, "TC1");
- registry->RemoveServiceConnectorForName("TC1");
- registry.reset();
- EXPECT_EQ(2, delete_count);
- }
-
- // Multiple.
- {
- ServiceRegistry registry;
- registry.SetServiceConnectorForName(new TestConnector(&delete_count),
- "TC1");
- registry.SetServiceConnectorForName(new TestConnector(&delete_count),
- "TC2");
- }
- EXPECT_EQ(4, delete_count);
-
- // Re-addition.
- {
- ServiceRegistry registry;
- registry.SetServiceConnectorForName(new TestConnector(&delete_count),
- "TC1");
- registry.SetServiceConnectorForName(new TestConnector(&delete_count),
- "TC1");
- EXPECT_EQ(5, delete_count);
- }
- EXPECT_EQ(6, delete_count);
-}
-
-} // namespace
-} // namespace internal
-} // namespace mojo
« no previous file with comments | « mojo/application/public/cpp/tests/BUILD.gn ('k') | mojo/application/public/interfaces/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698