| 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.h" | 5 #include "chrome/installer/util/product.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 version_key.WriteValue(google_update::kRegVersionField, | 71 version_key.WriteValue(google_update::kRegVersionField, |
| 72 base::UTF8ToWide( | 72 base::UTF8ToWide( |
| 73 current_version.GetString()).c_str()); | 73 current_version.GetString()).c_str()); |
| 74 | 74 |
| 75 // We started out with a non-msi product. | 75 // We started out with a non-msi product. |
| 76 machine_state.Initialize(); | 76 machine_state.Initialize(); |
| 77 const installer::ProductState* chrome_state = | 77 const installer::ProductState* chrome_state = |
| 78 machine_state.GetProductState(system_level, distribution->GetType()); | 78 machine_state.GetProductState(system_level, distribution->GetType()); |
| 79 EXPECT_TRUE(chrome_state != NULL); | 79 EXPECT_TRUE(chrome_state != NULL); |
| 80 if (chrome_state != NULL) { | 80 if (chrome_state != NULL) { |
| 81 EXPECT_TRUE(chrome_state->version().Equals(current_version)); | 81 EXPECT_EQ(chrome_state->version(), current_version); |
| 82 EXPECT_FALSE(chrome_state->is_msi()); | 82 EXPECT_FALSE(chrome_state->is_msi()); |
| 83 } | 83 } |
| 84 | 84 |
| 85 // Create a make-believe client state key. | 85 // Create a make-believe client state key. |
| 86 RegKey key; | 86 RegKey key; |
| 87 std::wstring state_key_path(distribution->GetStateKey()); | 87 std::wstring state_key_path(distribution->GetStateKey()); |
| 88 ASSERT_EQ(ERROR_SUCCESS, | 88 ASSERT_EQ(ERROR_SUCCESS, |
| 89 key.Create(root, state_key_path.c_str(), KEY_ALL_ACCESS)); | 89 key.Create(root, state_key_path.c_str(), KEY_ALL_ACCESS)); |
| 90 | 90 |
| 91 // Set the MSI marker, refresh, and verify that we now see the MSI marker. | 91 // Set the MSI marker, refresh, and verify that we now see the MSI marker. |
| 92 EXPECT_TRUE(product->SetMsiMarker(system_level, true)); | 92 EXPECT_TRUE(product->SetMsiMarker(system_level, true)); |
| 93 machine_state.Initialize(); | 93 machine_state.Initialize(); |
| 94 chrome_state = | 94 chrome_state = |
| 95 machine_state.GetProductState(system_level, distribution->GetType()); | 95 machine_state.GetProductState(system_level, distribution->GetType()); |
| 96 EXPECT_TRUE(chrome_state != NULL); | 96 EXPECT_TRUE(chrome_state != NULL); |
| 97 if (chrome_state != NULL) | 97 if (chrome_state != NULL) |
| 98 EXPECT_TRUE(chrome_state->is_msi()); | 98 EXPECT_TRUE(chrome_state->is_msi()); |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 | 101 |
| 102 TEST(ProductTest, LaunchChrome) { | 102 TEST(ProductTest, LaunchChrome) { |
| 103 // TODO(tommi): Test Product::LaunchChrome and | 103 // TODO(tommi): Test Product::LaunchChrome and |
| 104 // Product::LaunchChromeAndWait. | 104 // Product::LaunchChromeAndWait. |
| 105 NOTIMPLEMENTED(); | 105 NOTIMPLEMENTED(); |
| 106 } | 106 } |
| OLD | NEW |