Home | History | Annotate | Download | only in tests
      1 // Copyright 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "mojo/public/cpp/bindings/tests/message_queue.h"
      6 
      7 #include "base/logging.h"
      8 #include "mojo/public/cpp/bindings/message.h"
      9 
     10 namespace mojo {
     11 namespace test {
     12 
     13 MessageQueue::MessageQueue() {
     14 }
     15 
     16 MessageQueue::~MessageQueue() {
     17 }
     18 
     19 bool MessageQueue::IsEmpty() const {
     20   return queue_.empty();
     21 }
     22 
     23 void MessageQueue::Push(Message* message) {
     24   queue_.emplace(std::move(*message));
     25 }
     26 
     27 void MessageQueue::Pop(Message* message) {
     28   DCHECK(!queue_.empty());
     29   *message = std::move(queue_.front());
     30   Pop();
     31 }
     32 
     33 void MessageQueue::Pop() {
     34   DCHECK(!queue_.empty());
     35   queue_.pop();
     36 }
     37 
     38 }  // namespace test
     39 }  // namespace mojo
     40