chromium/third_party/angle/src/gpu_info_util/SystemInfo_unittest.cpp

//
// Copyright 2017 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// SystemInfo_unittest.cpp: Unit tests for SystemInfo* helper functions.
//

#include "common/platform.h"
#include "gpu_info_util/SystemInfo_internal.h"

#if defined(ANGLE_PLATFORM_APPLE)
#    include "common/apple_platform_utils.h"
#endif  // defined(ANGLE_PLATFORM_APPLE)

#include <gtest/gtest.h>

usingnamespaceangle;

namespace
{

// Test AMD Brahma driver version parsing
TEST(SystemInfoTest, AMDBrahmaVersionParsing)
{}

// Test AMD Catalyst version parsing
TEST(SystemInfoTest, AMDCatalystVersionParsing)
{}

#if defined(ANGLE_PLATFORM_MACOS)

// Test Mac machine model parsing
TEST(SystemInfoTest, MacMachineModelParsing)
{
    std::string model;
    int32_t major = 1, minor = 2;

    // Test on the empty string, that is returned by GetMachineModel on an error
    EXPECT_FALSE(ParseMacMachineModel("", &model, &major, &minor));
    EXPECT_EQ(0U, model.length());
    EXPECT_EQ(1, major);
    EXPECT_EQ(2, minor);

    // Test on an invalid string
    EXPECT_FALSE(ParseMacMachineModel("FooBar", &model, &major, &minor));

    // Test on a MacPro model
    EXPECT_TRUE(ParseMacMachineModel("MacPro4,1", &model, &major, &minor));
    EXPECT_EQ("MacPro", model);
    EXPECT_EQ(4, major);
    EXPECT_EQ(1, minor);

    // Test on a MacBookPro model
    EXPECT_TRUE(ParseMacMachineModel("MacBookPro6,2", &model, &major, &minor));
    EXPECT_EQ("MacBookPro", model);
    EXPECT_EQ(6, major);
    EXPECT_EQ(2, minor);
}

#endif  // defined(ANGLE_PLATFORM_MACOS)

// Test Windows CM Device ID parsing
TEST(SystemInfoTest, CMDeviceIDToDeviceAndVendorID)
{}

}  // anonymous namespace