machine_id_unittest.cc revision 5d1f7b1de12d16ceb2c938c56701a3e8bfa558f7
156c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks// Copyright (c) 2012 The Chromium Authors. All rights reserved.
256c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks// Use of this source code is governed by a BSD-style license that can be
356c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks// found in the LICENSE file.
456c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
556c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include "rlz/lib/machine_id.h"
656c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks
756c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include "base/strings/string16.h"
856c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include "base/strings/utf_string_conversions.h"
956c99cd2c2c1e6ab038dac5fced5b92ccf11ff6cDave Sparks#include "rlz/test/rlz_test_helpers.h"
107df30109963092559d3760c0661a020f9daf1030The Android Open Source Project#include "testing/gtest/include/gtest/gtest.h"
117df30109963092559d3760c0661a020f9daf1030The Android Open Source Project
127df30109963092559d3760c0661a020f9daf1030The Android Open Source Project// This test will fail if the behavior of GetMachineId changes.
137df30109963092559d3760c0661a020f9daf1030The Android Open Source ProjectTEST(MachineDealCodeTestMachineId, MachineId) {
147df30109963092559d3760c0661a020f9daf1030The Android Open Source Project  base::string16 computer_sid(base::UTF8ToUTF16(
157df30109963092559d3760c0661a020f9daf1030The Android Open Source Project        "S-1-5-21-2345599882-2448789067-1921365677"));
167df30109963092559d3760c0661a020f9daf1030The Android Open Source Project  std::string id;
177df30109963092559d3760c0661a020f9daf1030The Android Open Source Project  rlz_lib::testing::GetMachineIdImpl(computer_sid, 2651229008, &id);
187df30109963092559d3760c0661a020f9daf1030The Android Open Source Project  EXPECT_STREQ("A341BA986A7E86840688977FCF20C86E253F00919E068B50F8",
197df30109963092559d3760c0661a020f9daf1030The Android Open Source Project               id.c_str());
207df30109963092559d3760c0661a020f9daf1030The Android Open Source Project}
217df30109963092559d3760c0661a020f9daf1030The Android Open Source Project