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

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

Issue 1977043002: ApplicationConnection devolution, part 1. (Closed) Base URL: https://github.com/domokit/mojo.git@work791_service_registry_spimpl
Patch Set: rebased Created 4 years, 7 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/public/cpp/application/tests/BUILD.gn ('k') | services/dart/content_handler_main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/application/tests/service_registry_unittest.cc
diff --git a/mojo/public/cpp/application/tests/service_registry_unittest.cc b/mojo/public/cpp/application/tests/service_registry_unittest.cc
deleted file mode 100644
index 304259e41d077303b24c07037faf39c780a3867a..0000000000000000000000000000000000000000
--- a/mojo/public/cpp/application/tests/service_registry_unittest.cc
+++ /dev/null
@@ -1,70 +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/public/cpp/application/lib/service_registry.h"
-
-#include "mojo/public/cpp/application/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(const ConnectionContext& connection_context,
- 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.
- {
- ServiceRegistry registry;
- ServiceConnector* c = new TestConnector(&delete_count);
- registry.SetServiceConnectorForName(c, "TC1");
- registry.RemoveServiceConnectorForName("TC1");
- 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/public/cpp/application/tests/BUILD.gn ('k') | services/dart/content_handler_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698