1 // Copyright 2017 The Chromium 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 "chrome/common/chrome_constants.h" 6 7 #include <memory> 8 9 #include "base/file_version_info.h" 10 #include "base/files/file_path.h" 11 #include "base/path_service.h" 12 #include "base/strings/utf_string_conversions.h" 13 #include "testing/gtest/include/gtest/gtest.h" 14 15 namespace chrome { 16 17 // Verify that |kChromeVersion| is equal to the version in the VS_VERSION_INFO 18 // resource of chrome.exe. TEST(ChromeConstants,ChromeVersion)19TEST(ChromeConstants, ChromeVersion) { 20 base::FilePath current_exe_dir; 21 EXPECT_TRUE(base::PathService::Get(base::DIR_EXE, ¤t_exe_dir)); 22 base::FilePath chrome_exe_path = 23 current_exe_dir.Append(chrome::kBrowserProcessExecutableName); 24 25 std::unique_ptr<FileVersionInfo> file_version_info( 26 FileVersionInfo::CreateFileVersionInfo(chrome_exe_path)); 27 ASSERT_TRUE(file_version_info); 28 EXPECT_EQ(base::UTF16ToASCII(file_version_info->file_version()), 29 kChromeVersion); 30 } 31 32 } // namespace chrome 33