15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "rlz/lib/machine_id.h"
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
7868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/strings/string16.h"
8868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/strings/utf_string_conversions.h"
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "rlz/test/rlz_test_helpers.h"
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "testing/gtest/include/gtest/gtest.h"
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This test will fail if the behavior of GetMachineId changes.
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)TEST(MachineDealCodeTestMachineId, MachineId) {
145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  base::string16 computer_sid(base::UTF8ToUTF16(
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        "S-1-5-21-2345599882-2448789067-1921365677"));
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  std::string id;
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  rlz_lib::testing::GetMachineIdImpl(computer_sid, 2651229008, &id);
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  EXPECT_STREQ("A341BA986A7E86840688977FCF20C86E253F00919E068B50F8",
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)               id.c_str());
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
21