Home | History | Annotate | Download | only in vts
      1 /*
      2  * Copyright (C) 2017 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #include <composer-vts/2.1/TestCommandReader.h>
     18 
     19 #include <gtest/gtest.h>
     20 
     21 namespace android {
     22 namespace hardware {
     23 namespace graphics {
     24 namespace composer {
     25 namespace V2_1 {
     26 namespace vts {
     27 
     28 void TestCommandReader::parse() {
     29     while (!isEmpty()) {
     30         IComposerClient::Command command;
     31         uint16_t length;
     32         ASSERT_TRUE(beginCommand(&command, &length));
     33 
     34         switch (command) {
     35             case IComposerClient::Command::SET_ERROR: {
     36                 ASSERT_EQ(2, length);
     37                 auto loc = read();
     38                 auto err = readSigned();
     39                 GTEST_FAIL() << "unexpected error " << err << " at location " << loc;
     40             } break;
     41             case IComposerClient::Command::SELECT_DISPLAY:
     42             case IComposerClient::Command::SET_CHANGED_COMPOSITION_TYPES:
     43             case IComposerClient::Command::SET_DISPLAY_REQUESTS:
     44             case IComposerClient::Command::SET_PRESENT_FENCE:
     45             case IComposerClient::Command::SET_RELEASE_FENCES:
     46                 break;
     47             default:
     48                 GTEST_FAIL() << "unexpected return command " << std::hex
     49                              << static_cast<int>(command);
     50                 break;
     51         }
     52 
     53         endCommand();
     54     }
     55 }
     56 
     57 }  // namespace vts
     58 }  // namespace V2_1
     59 }  // namespace composer
     60 }  // namespace graphics
     61 }  // namespace hardware
     62 }  // namespace android
     63