| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 package org.chromium.mojo.bindings; | 5 package org.chromium.mojo.bindings; |
| 6 | 6 |
| 7 import org.chromium.mojo.TestUtils; | 7 import org.chromium.mojo.TestUtils; |
| 8 import org.chromium.mojo.system.Handle; | 8 import org.chromium.mojo.system.Handle; |
| 9 import org.chromium.mojo.system.MojoException; | 9 import org.chromium.mojo.system.MojoException; |
| 10 import org.chromium.mojo.system.Pair; | 10 import org.chromium.mojo.system.Pair; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 /** | 73 /** |
| 74 * Returns the last recorded exception. | 74 * Returns the last recorded exception. |
| 75 */ | 75 */ |
| 76 public MojoException getLastMojoException() { | 76 public MojoException getLastMojoException() { |
| 77 return mLastMojoException; | 77 return mLastMojoException; |
| 78 } | 78 } |
| 79 | 79 |
| 80 } | 80 } |
| 81 | 81 |
| 82 /** | 82 /** |
| 83 * Creates a new valid {@link MessageWithHeader}. | 83 * Creates a new valid {@link Message}. The message will have a valid header
. |
| 84 */ | 84 */ |
| 85 public static MessageWithHeader newRandomMessageWithHeader(int size) { | 85 public static Message newRandomMessageWithHeader(int size) { |
| 86 assert size > 16; | 86 assert size > 16; |
| 87 ByteBuffer message = TestUtils.newRandomBuffer(size); | 87 ByteBuffer message = TestUtils.newRandomBuffer(size); |
| 88 int[] headerAsInts = { 16, 2, 0, 0 }; | 88 int[] headerAsInts = { 16, 2, 0, 0 }; |
| 89 for (int i = 0; i < 4; ++i) { | 89 for (int i = 0; i < 4; ++i) { |
| 90 message.putInt(4 * i, headerAsInts[i]); | 90 message.putInt(4 * i, headerAsInts[i]); |
| 91 } | 91 } |
| 92 message.position(0); | 92 message.position(0); |
| 93 return new SimpleMessage(message, new ArrayList<Handle>()).asMojoMessage
(); | 93 return new SimpleMessage(message, new ArrayList<Handle>()); |
| 94 } | 94 } |
| 95 } | 95 } |
| OLD | NEW |