1 // Copyright 2016 The Chromium OS 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 "mock_install_attributes_reader.h" 6 7 MockInstallAttributesReader::MockInstallAttributesReader( 8 const cryptohome::SerializedInstallAttributes& install_attributes) { 9 for (int i = 0; i < install_attributes.attributes_size(); ++i) { 10 const cryptohome::SerializedInstallAttributes_Attribute& attribute = 11 install_attributes.attributes(i); 12 // Cast value to C string and back to remove trailing zero. 13 attributes_[attribute.name()] = std::string(attribute.value().c_str()); 14 } 15 initialized_ = true; 16 } 17 18 MockInstallAttributesReader::MockInstallAttributesReader( 19 const std::string& device_mode, bool initialized) { 20 attributes_[kAttrMode] = device_mode; 21 initialized_ = initialized; 22 } 23