OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/test/test_reg_util_win.h" | 8 #include "base/test/test_reg_util_win.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/installer/util/chrome_frame_distribution.h" | 10 #include "chrome/installer/util/chrome_frame_distribution.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 { | 91 { |
92 RegistryOverrideManager override_manager; | 92 RegistryOverrideManager override_manager; |
93 override_manager.OverrideRegistry(root, L"root_pit"); | 93 override_manager.OverrideRegistry(root, L"root_pit"); |
94 | 94 |
95 // Let's pretend chrome is installed. | 95 // Let's pretend chrome is installed. |
96 RegKey version_key(root, distribution->GetVersionKey().c_str(), | 96 RegKey version_key(root, distribution->GetVersionKey().c_str(), |
97 KEY_ALL_ACCESS); | 97 KEY_ALL_ACCESS); |
98 ASSERT_TRUE(version_key.Valid()); | 98 ASSERT_TRUE(version_key.Valid()); |
99 | 99 |
100 const char kCurrentVersion[] = "1.2.3.4"; | 100 const char kCurrentVersion[] = "1.2.3.4"; |
101 scoped_ptr<Version> current_version( | 101 Version current_version(kCurrentVersion); |
102 Version::GetVersionFromString(kCurrentVersion)); | |
103 version_key.WriteValue(google_update::kRegVersionField, | 102 version_key.WriteValue(google_update::kRegVersionField, |
104 UTF8ToWide(current_version->GetString()).c_str()); | 103 UTF8ToWide(current_version.GetString()).c_str()); |
105 | 104 |
106 // We started out with a non-msi product. | 105 // We started out with a non-msi product. |
107 machine_state.Initialize(); | 106 machine_state.Initialize(); |
108 const installer::ProductState* chrome_state = | 107 const installer::ProductState* chrome_state = |
109 machine_state.GetProductState(system_level, distribution->GetType()); | 108 machine_state.GetProductState(system_level, distribution->GetType()); |
110 EXPECT_TRUE(chrome_state != NULL); | 109 EXPECT_TRUE(chrome_state != NULL); |
111 if (chrome_state != NULL) { | 110 if (chrome_state != NULL) { |
112 EXPECT_TRUE(chrome_state->version().Equals(*current_version.get())); | 111 EXPECT_TRUE(chrome_state->version().Equals(current_version)); |
113 EXPECT_FALSE(chrome_state->is_msi()); | 112 EXPECT_FALSE(chrome_state->is_msi()); |
114 } | 113 } |
115 | 114 |
116 // Create a make-believe client state key. | 115 // Create a make-believe client state key. |
117 RegKey key; | 116 RegKey key; |
118 std::wstring state_key_path(distribution->GetStateKey()); | 117 std::wstring state_key_path(distribution->GetStateKey()); |
119 ASSERT_EQ(ERROR_SUCCESS, | 118 ASSERT_EQ(ERROR_SUCCESS, |
120 key.Create(root, state_key_path.c_str(), KEY_ALL_ACCESS)); | 119 key.Create(root, state_key_path.c_str(), KEY_ALL_ACCESS)); |
121 | 120 |
122 // Set the MSI marker, refresh, and verify that we now see the MSI marker. | 121 // Set the MSI marker, refresh, and verify that we now see the MSI marker. |
123 EXPECT_TRUE(product->SetMsiMarker(system_level, true)); | 122 EXPECT_TRUE(product->SetMsiMarker(system_level, true)); |
124 machine_state.Initialize(); | 123 machine_state.Initialize(); |
125 chrome_state = | 124 chrome_state = |
126 machine_state.GetProductState(system_level, distribution->GetType()); | 125 machine_state.GetProductState(system_level, distribution->GetType()); |
127 EXPECT_TRUE(chrome_state != NULL); | 126 EXPECT_TRUE(chrome_state != NULL); |
128 if (chrome_state != NULL) | 127 if (chrome_state != NULL) |
129 EXPECT_TRUE(chrome_state->is_msi()); | 128 EXPECT_TRUE(chrome_state->is_msi()); |
130 } | 129 } |
131 } | 130 } |
132 | 131 |
133 TEST_F(ProductTest, LaunchChrome) { | 132 TEST_F(ProductTest, LaunchChrome) { |
134 // TODO(tommi): Test Product::LaunchChrome and | 133 // TODO(tommi): Test Product::LaunchChrome and |
135 // Product::LaunchChromeAndWait. | 134 // Product::LaunchChromeAndWait. |
136 LOG(ERROR) << "Test not implemented."; | 135 LOG(ERROR) << "Test not implemented."; |
137 } | 136 } |
OLD | NEW |