• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/**
2 * @fileoverview Handwritten code of ConformanceResponse.
3 */
4goog.module('proto.conformance.ConformanceResponse');
5
6const ByteString = goog.require('protobuf.ByteString');
7const Kernel = goog.require('protobuf.runtime.Kernel');
8
9/**
10 * Handwritten code of conformance.ConformanceResponse.
11 * This is used to send response from the conformance testee to the test runner.
12 * Check //third_party/protobuf/testing/protobuf/conformance/conformance.proto
13 * for more details.
14 * @final
15 */
16class ConformanceResponse {
17  /**
18   * @param {!ArrayBuffer} bytes
19   * @private
20   */
21  constructor(bytes) {
22    /** @private @const {!Kernel} */
23    this.accessor_ = Kernel.fromArrayBuffer(bytes);
24  }
25
26  /**
27   * Create an empty response instance.
28   * @return {!ConformanceResponse}
29   */
30  static createEmpty() {
31    return new ConformanceResponse(new ArrayBuffer(0));
32  }
33
34  /**
35   * Sets parse_error field.
36   * @param {string} value
37   */
38  setParseError(value) {
39    this.accessor_.setString(1, value);
40  }
41
42  /**
43   * Sets runtime_error field.
44   * @param {string} value
45   */
46  setRuntimeError(value) {
47    this.accessor_.setString(2, value);
48  }
49
50  /**
51   * Sets protobuf_payload field.
52   * @param {!ArrayBuffer} value
53   */
54  setProtobufPayload(value) {
55    const bytesString = ByteString.fromArrayBuffer(value);
56    this.accessor_.setBytes(3, bytesString);
57  }
58
59  /**
60   * Sets skipped field.
61   * @param {string} value
62   */
63  setSkipped(value) {
64    this.accessor_.setString(5, value);
65  }
66
67  /**
68   * Serializes into binary data.
69   * @return {!ArrayBuffer}
70   */
71  serialize() {
72    return this.accessor_.serialize();
73  }
74}
75
76exports = ConformanceResponse;
77