OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/installer/util/product_unittest.h" | 5 #include "chrome/installer/util/product_unittest.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/test/test_reg_util_win.h" | 10 #include "base/test/test_reg_util_win.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); | 69 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); |
70 EXPECT_FALSE(user_data_dir.empty()); | 70 EXPECT_FALSE(user_data_dir.empty()); |
71 | 71 |
72 base::FilePath program_files; | 72 base::FilePath program_files; |
73 ASSERT_TRUE(PathService::Get(base::DIR_PROGRAM_FILES, &program_files)); | 73 ASSERT_TRUE(PathService::Get(base::DIR_PROGRAM_FILES, &program_files)); |
74 // The User Data path should never be under program files, even though | 74 // The User Data path should never be under program files, even though |
75 // system_level is true. | 75 // system_level is true. |
76 EXPECT_EQ(std::wstring::npos, | 76 EXPECT_EQ(std::wstring::npos, |
77 user_data_dir.value().find(program_files.value())); | 77 user_data_dir.value().find(program_files.value())); |
78 | 78 |
79 // There should be no installed version in the registry. | |
80 machine_state.Initialize(); | |
81 EXPECT_TRUE(machine_state.GetProductState( | |
82 system_level, distribution->GetType()) == NULL); | |
83 | |
84 HKEY root = installer_state.root_key(); | 79 HKEY root = installer_state.root_key(); |
85 { | 80 { |
86 RegistryOverrideManager override_manager; | 81 RegistryOverrideManager override_manager; |
87 override_manager.OverrideRegistry(root, L"root_pit"); | 82 override_manager.OverrideRegistry(root, L"root_pit"); |
88 | 83 |
| 84 // There should be no installed version in the registry. |
| 85 machine_state.Initialize(); |
| 86 EXPECT_TRUE(machine_state.GetProductState( |
| 87 system_level, distribution->GetType()) == NULL); |
| 88 |
89 // Let's pretend chrome is installed. | 89 // Let's pretend chrome is installed. |
90 RegKey version_key(root, distribution->GetVersionKey().c_str(), | 90 RegKey version_key(root, distribution->GetVersionKey().c_str(), |
91 KEY_ALL_ACCESS); | 91 KEY_ALL_ACCESS); |
92 ASSERT_TRUE(version_key.Valid()); | 92 ASSERT_TRUE(version_key.Valid()); |
93 | 93 |
94 const char kCurrentVersion[] = "1.2.3.4"; | 94 const char kCurrentVersion[] = "1.2.3.4"; |
95 Version current_version(kCurrentVersion); | 95 Version current_version(kCurrentVersion); |
96 version_key.WriteValue(google_update::kRegVersionField, | 96 version_key.WriteValue(google_update::kRegVersionField, |
97 base::UTF8ToWide( | 97 base::UTF8ToWide( |
98 current_version.GetString()).c_str()); | 98 current_version.GetString()).c_str()); |
(...skipping 23 matching lines...) Expand all Loading... |
122 if (chrome_state != NULL) | 122 if (chrome_state != NULL) |
123 EXPECT_TRUE(chrome_state->is_msi()); | 123 EXPECT_TRUE(chrome_state->is_msi()); |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
127 TEST_F(ProductTest, LaunchChrome) { | 127 TEST_F(ProductTest, LaunchChrome) { |
128 // TODO(tommi): Test Product::LaunchChrome and | 128 // TODO(tommi): Test Product::LaunchChrome and |
129 // Product::LaunchChromeAndWait. | 129 // Product::LaunchChromeAndWait. |
130 LOG(ERROR) << "Test not implemented."; | 130 LOG(ERROR) << "Test not implemented."; |
131 } | 131 } |
OLD | NEW |