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

Side by Side Diff: 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 unified diff | Download patch
« no previous file with comments | « services/catalog/entry.cc ('k') | services/catalog/factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/services/catalog/entry.h" 5 #include "services/catalog/entry.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/json/json_file_value_serializer.h" 8 #include "base/json/json_file_value_serializer.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "services/shell/public/cpp/capabilities.h" 12 #include "services/shell/public/cpp/capabilities.h"
13 #include "services/shell/public/cpp/names.h" 13 #include "services/shell/public/cpp/names.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
(...skipping 12 matching lines...) Expand all
28 CHECK(value->GetAsDictionary(&dictionary)); 28 CHECK(value->GetAsDictionary(&dictionary));
29 if (out_value) 29 if (out_value)
30 *out_value = std::move(value); 30 *out_value = std::move(value);
31 return Entry::Deserialize(*dictionary); 31 return Entry::Deserialize(*dictionary);
32 } 32 }
33 33
34 scoped_ptr<base::Value> ReadManifest(const std::string& manifest) { 34 scoped_ptr<base::Value> ReadManifest(const std::string& manifest) {
35 base::FilePath manifest_path; 35 base::FilePath manifest_path;
36 PathService::Get(base::DIR_SOURCE_ROOT, &manifest_path); 36 PathService::Get(base::DIR_SOURCE_ROOT, &manifest_path);
37 manifest_path = manifest_path.AppendASCII( 37 manifest_path = manifest_path.AppendASCII(
38 "mojo/services/catalog/data/" + manifest); 38 "services/catalog/data/" + manifest);
39 39
40 JSONFileValueDeserializer deserializer(manifest_path); 40 JSONFileValueDeserializer deserializer(manifest_path);
41 int error = 0; 41 int error = 0;
42 std::string message; 42 std::string message;
43 // TODO(beng): probably want to do more detailed error checking. This should 43 // TODO(beng): probably want to do more detailed error checking. This should
44 // be done when figuring out if to unblock connection 44 // be done when figuring out if to unblock connection
45 // completion. 45 // completion.
46 return deserializer.Deserialize(&error, &message); 46 return deserializer.Deserialize(&error, &message);
47 } 47 }
48 48
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 EXPECT_EQ(*entry, *reconstituted); 93 EXPECT_EQ(*entry, *reconstituted);
94 } 94 }
95 95
96 TEST_F(EntryTest, Malformed) { 96 TEST_F(EntryTest, Malformed) {
97 scoped_ptr<base::Value> value = ReadManifest("malformed"); 97 scoped_ptr<base::Value> value = ReadManifest("malformed");
98 EXPECT_FALSE(value.get()); 98 EXPECT_FALSE(value.get());
99 } 99 }
100 100
101 101
102 } // namespace catalog 102 } // namespace catalog
OLDNEW
« no previous file with comments | « services/catalog/entry.cc ('k') | services/catalog/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698