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

Unified Diff: services/shell/public/cpp/tests/interface_registry_unittest.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/tests/BUILD.gn ('k') | services/shell/public/cpp/typemaps.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/shell/public/cpp/tests/interface_registry_unittest.cc
diff --git a/services/shell/public/cpp/tests/interface_registry_unittest.cc b/services/shell/public/cpp/tests/interface_registry_unittest.cc
deleted file mode 100644
index 747d9da234966e926620bbb982c0557b9e130381..0000000000000000000000000000000000000000
--- a/services/shell/public/cpp/tests/interface_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 "services/shell/public/cpp/interface_registry.h"
-
-#include "base/message_loop/message_loop.h"
-#include "services/shell/public/cpp/interface_binder.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace shell {
-namespace internal {
-namespace {
-
-class TestBinder : public InterfaceBinder {
- public:
- explicit TestBinder(int* delete_count) : delete_count_(delete_count) {}
- ~TestBinder() override { (*delete_count_)++; }
- void BindInterface(const shell::Identity& remote_identity,
- const std::string& interface_name,
- mojo::ScopedMessagePipeHandle client_handle) override {}
-
- private:
- int* delete_count_;
-};
-
-TEST(InterfaceRegistryTest, Ownership) {
- base::MessageLoop message_loop_;
- int delete_count = 0;
-
- // Destruction.
- {
- InterfaceRegistry registry;
- InterfaceRegistry::TestApi test_api(&registry);
- test_api.SetInterfaceBinderForName(new TestBinder(&delete_count), "TC1");
- }
- EXPECT_EQ(1, delete_count);
-
- // Removal.
- {
- std::unique_ptr<InterfaceRegistry> registry(new InterfaceRegistry);
- InterfaceBinder* b = new TestBinder(&delete_count);
- InterfaceRegistry::TestApi test_api(registry.get());
- test_api.SetInterfaceBinderForName(b, "TC1");
- registry->RemoveInterface("TC1");
- registry.reset();
- EXPECT_EQ(2, delete_count);
- }
-
- // Multiple.
- {
- InterfaceRegistry registry;
- InterfaceRegistry::TestApi test_api(&registry);
- test_api.SetInterfaceBinderForName(new TestBinder(&delete_count), "TC1");
- test_api.SetInterfaceBinderForName(new TestBinder(&delete_count), "TC2");
- }
- EXPECT_EQ(4, delete_count);
-
- // Re-addition.
- {
- InterfaceRegistry registry;
- InterfaceRegistry::TestApi test_api(&registry);
- test_api.SetInterfaceBinderForName(new TestBinder(&delete_count), "TC1");
- test_api.SetInterfaceBinderForName(new TestBinder(&delete_count), "TC1");
- EXPECT_EQ(5, delete_count);
- }
- EXPECT_EQ(6, delete_count);
-}
-
-} // namespace
-} // namespace internal
-} // namespace shell
« no previous file with comments | « services/shell/public/cpp/tests/BUILD.gn ('k') | services/shell/public/cpp/typemaps.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698