| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 <stdio.h> | 5 #include <stdio.h> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <gtest/gtest.h> | 7 #include <gtest/gtest.h> |
| 8 #include "update_engine/install_plan.h" | 8 #include "update_engine/install_plan.h" |
| 9 #include "update_engine/omaha_request_params.h" | 9 #include "update_engine/omaha_request_params.h" |
| 10 #include "update_engine/test_utils.h" | 10 #include "update_engine/test_utils.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 EXPECT_TRUE(DoTest(&out)); | 91 EXPECT_TRUE(DoTest(&out)); |
| 92 EXPECT_TRUE(IsValidGuid(out.machine_id)) << "id: " << out.machine_id; | 92 EXPECT_TRUE(IsValidGuid(out.machine_id)) << "id: " << out.machine_id; |
| 93 // for now we're just using the machine id here | 93 // for now we're just using the machine id here |
| 94 EXPECT_TRUE(IsValidGuid(out.user_id)) << "id: " << out.user_id; | 94 EXPECT_TRUE(IsValidGuid(out.user_id)) << "id: " << out.user_id; |
| 95 EXPECT_EQ("Chrome OS", out.os_platform); | 95 EXPECT_EQ("Chrome OS", out.os_platform); |
| 96 EXPECT_EQ(string("0.2.2.3_") + GetMachineType(), out.os_sp); | 96 EXPECT_EQ(string("0.2.2.3_") + GetMachineType(), out.os_sp); |
| 97 EXPECT_EQ("arm-generic", out.os_board); | 97 EXPECT_EQ("arm-generic", out.os_board); |
| 98 EXPECT_EQ("{87efface-864d-49a5-9bb3-4b050a7c227a}", out.app_id); | 98 EXPECT_EQ("{87efface-864d-49a5-9bb3-4b050a7c227a}", out.app_id); |
| 99 EXPECT_EQ("0.2.2.3", out.app_version); | 99 EXPECT_EQ("0.2.2.3", out.app_version); |
| 100 EXPECT_EQ("en-US", out.app_lang); | 100 EXPECT_EQ("en-US", out.app_lang); |
| 101 EXPECT_TRUE(out.delta_okay); |
| 101 EXPECT_EQ("footrack", out.app_track); | 102 EXPECT_EQ("footrack", out.app_track); |
| 102 } | 103 } |
| 103 EXPECT_EQ(0, System(string("rm -rf ") + kTestDir)); | 104 EXPECT_EQ(0, System(string("rm -rf ") + kTestDir)); |
| 104 } | 105 } |
| 105 | 106 |
| 106 TEST_F(OmahaRequestDeviceParamsTest, MissingTrackTest) { | 107 TEST_F(OmahaRequestDeviceParamsTest, MissingTrackTest) { |
| 107 ASSERT_EQ(0, System(string("mkdir -p ") + kTestDir + "/etc")); | 108 ASSERT_EQ(0, System(string("mkdir -p ") + kTestDir + "/etc")); |
| 108 ASSERT_EQ(0, System(string("mkdir -p ") + kTestDir + | 109 ASSERT_EQ(0, System(string("mkdir -p ") + kTestDir + |
| 109 utils::kStatefulPartition + "/etc")); | 110 utils::kStatefulPartition + "/etc")); |
| 110 { | 111 { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 kTestDir + | 170 kTestDir + |
| 170 utils::kStatefulPartition + "/etc/omaha_id", | 171 utils::kStatefulPartition + "/etc/omaha_id", |
| 171 &machine_id)); | 172 &machine_id)); |
| 172 EXPECT_EQ(machine_id, out1.machine_id); | 173 EXPECT_EQ(machine_id, out1.machine_id); |
| 173 OmahaRequestParams out2; | 174 OmahaRequestParams out2; |
| 174 EXPECT_TRUE(DoTest(&out2)); | 175 EXPECT_TRUE(DoTest(&out2)); |
| 175 EXPECT_EQ(machine_id, out2.machine_id); | 176 EXPECT_EQ(machine_id, out2.machine_id); |
| 176 EXPECT_EQ(0, System(string("rm -rf ") + kTestDir)); | 177 EXPECT_EQ(0, System(string("rm -rf ") + kTestDir)); |
| 177 } | 178 } |
| 178 | 179 |
| 180 TEST_F(OmahaRequestDeviceParamsTest, NoDeltasTest) { |
| 181 ASSERT_EQ(0, System(string("mkdir -p ") + kTestDir + "/etc")); |
| 182 ASSERT_EQ(0, System(string("mkdir -p ") + kTestDir + |
| 183 utils::kStatefulPartition + "/etc")); |
| 184 ASSERT_TRUE(WriteFileString( |
| 185 kTestDir + "/etc/lsb-release", |
| 186 "CHROMEOS_RELEASE_FOO=CHROMEOS_RELEASE_VERSION=1.2.3.4\n" |
| 187 "CHROMEOS_RELEASE_VERSION=0.2.2.3\n" |
| 188 "CHROMEOS_RELEASE_TRXCK=footrack")); |
| 189 ASSERT_TRUE(WriteFileString(kTestDir + "/.nodelta", "")); |
| 190 OmahaRequestParams out; |
| 191 EXPECT_TRUE(DoTest(&out)); |
| 192 EXPECT_FALSE(out.delta_okay); |
| 193 EXPECT_EQ(0, System(string("rm -rf ") + kTestDir)); |
| 194 } |
| 195 |
| 179 } // namespace chromeos_update_engine | 196 } // namespace chromeos_update_engine |
| OLD | NEW |