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

Unified Diff: mojo/services/catalog/entry_unittest.cc

Issue 1878893002: Move //mojo/services tracing & catalog to //services (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@63move
Patch Set: . Created 4 years, 8 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/services/catalog/entry.cc ('k') | mojo/services/catalog/factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/catalog/entry_unittest.cc
diff --git a/mojo/services/catalog/entry_unittest.cc b/mojo/services/catalog/entry_unittest.cc
deleted file mode 100644
index 643841c74aed4d186844dfeef5e15952ac9fe5fe..0000000000000000000000000000000000000000
--- a/mojo/services/catalog/entry_unittest.cc
+++ /dev/null
@@ -1,102 +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 "mojo/services/catalog/entry.h"
-
-#include "base/files/file_path.h"
-#include "base/json/json_file_value_serializer.h"
-#include "base/macros.h"
-#include "base/path_service.h"
-#include "base/values.h"
-#include "services/shell/public/cpp/capabilities.h"
-#include "services/shell/public/cpp/names.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace catalog {
-
-class EntryTest : public testing::Test {
- public:
- EntryTest() {}
- ~EntryTest() override {}
-
- protected:
- scoped_ptr<Entry> ReadEntry(const std::string& manifest,
- scoped_ptr<base::Value>* out_value) {
- scoped_ptr<base::Value> value = ReadManifest(manifest);
- base::DictionaryValue* dictionary = nullptr;
- CHECK(value->GetAsDictionary(&dictionary));
- if (out_value)
- *out_value = std::move(value);
- return Entry::Deserialize(*dictionary);
- }
-
- scoped_ptr<base::Value> ReadManifest(const std::string& manifest) {
- base::FilePath manifest_path;
- PathService::Get(base::DIR_SOURCE_ROOT, &manifest_path);
- manifest_path = manifest_path.AppendASCII(
- "mojo/services/catalog/data/" + manifest);
-
- JSONFileValueDeserializer deserializer(manifest_path);
- int error = 0;
- std::string message;
- // TODO(beng): probably want to do more detailed error checking. This should
- // be done when figuring out if to unblock connection
- // completion.
- return deserializer.Deserialize(&error, &message);
- }
-
- private:
- void SetUp() override {}
- void TearDown() override {}
-
- DISALLOW_COPY_AND_ASSIGN(EntryTest);
-};
-
-TEST_F(EntryTest, Simple) {
- scoped_ptr<Entry> entry = ReadEntry("simple", nullptr);
- EXPECT_EQ("mojo:foo", entry->name());
- EXPECT_EQ(mojo::GetNamePath(entry->name()), entry->qualifier());
- EXPECT_EQ("Foo", entry->display_name());
-}
-
-TEST_F(EntryTest, Instance) {
- scoped_ptr<Entry> entry = ReadEntry("instance", nullptr);
- EXPECT_EQ("mojo:foo", entry->name());
- EXPECT_EQ("bar", entry->qualifier());
- EXPECT_EQ("Foo", entry->display_name());
-}
-
-TEST_F(EntryTest, Capabilities) {
- scoped_ptr<Entry> entry = ReadEntry("capabilities", nullptr);
-
- EXPECT_EQ("mojo:foo", entry->name());
- EXPECT_EQ("bar", entry->qualifier());
- EXPECT_EQ("Foo", entry->display_name());
- mojo::CapabilitySpec spec;
- mojo::CapabilityRequest request;
- request.interfaces.insert("mojo::Bar");
- spec.required["mojo:bar"] = request;
- EXPECT_EQ(spec, entry->capabilities());
-}
-
-TEST_F(EntryTest, Serialization) {
- scoped_ptr<base::Value> value;
- scoped_ptr<Entry> entry = ReadEntry("serialization", &value);
-
- scoped_ptr<base::DictionaryValue> serialized(entry->Serialize());
-
- // We can't just compare values, since during deserialization some of the
- // lists get converted to std::sets, which are sorted, so Value::Equals will
- // fail.
- scoped_ptr<Entry> reconstituted = Entry::Deserialize(*serialized.get());
- EXPECT_EQ(*entry, *reconstituted);
-}
-
-TEST_F(EntryTest, Malformed) {
- scoped_ptr<base::Value> value = ReadManifest("malformed");
- EXPECT_FALSE(value.get());
-}
-
-
-} // namespace catalog
« no previous file with comments | « mojo/services/catalog/entry.cc ('k') | mojo/services/catalog/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698