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

Side by Side Diff: server/static/rpcexplorer/test/rpc-descriptor-util.html

Issue 1695893004: RPC Explorer (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@rpcepxlorer-deps
Patch Set: 80 chars Created 4 years, 9 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
OLDNEW
(Empty)
1 <!--
2 Copyright 2016 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file.
5 -->
6
7 <!doctype html>
8 <title>rpc-descriptor-util</title>
9
10 <script src="../../bower_components/web-component-tester/browser.js"></script>
11 <link rel="import" href="../rpc-descriptor-util.html">
12 <link rel="import" href="descriptor.html">
13
14 <script>
15 suite('rpcExplorer.descUtil', function() {
16 var util = rpcExplorer.descUtil;
17
18 suite('resolve', function() {
19 function testResolve(fullName, type, name) {
20 test(fullName, function () {
21 var result = util.resolve(discoveryDescriptor, fullName);
22 expect(result).to.ok;
23 expect(result.type).to.equal(type);
24 expect(result.desc).to.ok;
25 expect(result.desc.name).to.equal(name);
26 });
27 }
28
29 testResolve('discovery.Discovery', 'service', 'Discovery');
30 testResolve('discovery.Discovery.Describe', 'method', 'Describe');
31 testResolve(
32 'google.protobuf.FileDescriptorSet',
33 'messageType',
34 'FileDescriptorSet');
35 testResolve(
36 'google.protobuf.FileDescriptorSet.file',
37 'field',
38 'file');
39 testResolve(
40 'google.protobuf.FieldDescriptorProto.Type',
41 'enumType',
42 'Type');
43 testResolve(
44 'google.protobuf.FieldOptions.JSType.JS_NORMAL',
45 'enumValue',
46 'JS_NORMAL');
47 });
48
49 suite('annotate', function() {
50 var descriptor = JSON.parse(JSON.stringify(discoveryDescriptor));
51 util.annotateSet(descriptor);
52
53 function testAnnotate(name, comment) {
54 test(name, function() {
55 var desc = util.resolve(descriptor, name).desc;
56 expect(desc).to.be.ok;
57 expect(desc.source_code_info).to.be.ok;
58 expect(desc.source_code_info.leading_comments).to.equal(comment);
59 });
60 }
61
62 testAnnotate(
63 'discovery.Discovery',
64 ' Describes services.\n');
65 testAnnotate(
66 'discovery.Discovery.Describe',
67 (' Returns a list of services and a\n' +
68 ' descriptor.FileDescriptorSet that covers them all.\n'));
69 testAnnotate(
70 'discovery.Void',
71 ' Void is an empty message.\n');
72 testAnnotate(
73 'discovery.DescribeResponse.services',
74 ' Services are service names provided by a server.\n');
75 testAnnotate(
76 'google.protobuf.FileOptions.OptimizeMode',
77 ' Generated classes can be optimized for speed or code size.\n');
78 testAnnotate(
79 'google.protobuf.FieldOptions.JSType.JS_NORMAL',
80 ' Use the default type.\n');
81 });
82 });
83 </script>
OLDNEW
« no previous file with comments | « server/static/rpcexplorer/test/rpc-completer.html ('k') | server/static/rpcexplorer/third_party/ace/README.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698