OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <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_prep_action.h" | 9 #include "update_engine/omaha_request_prep_action.h" |
10 #include "update_engine/test_utils.h" | 10 #include "update_engine/test_utils.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 104 } |
105 } // namespace {} | 105 } // namespace {} |
106 | 106 |
107 TEST_F(OmahaRequestPrepActionTest, SimpleTest) { | 107 TEST_F(OmahaRequestPrepActionTest, SimpleTest) { |
108 ASSERT_EQ(0, System(string("mkdir -p ") + kTestDir + "/etc")); | 108 ASSERT_EQ(0, System(string("mkdir -p ") + kTestDir + "/etc")); |
109 ASSERT_EQ(0, System(string("mkdir -p ") + kTestDir + | 109 ASSERT_EQ(0, System(string("mkdir -p ") + kTestDir + |
110 utils::kStatefulPartition + "/etc")); | 110 utils::kStatefulPartition + "/etc")); |
111 { | 111 { |
112 ASSERT_TRUE(WriteFileString( | 112 ASSERT_TRUE(WriteFileString( |
113 kTestDir + "/etc/lsb-release", | 113 kTestDir + "/etc/lsb-release", |
| 114 "CHROMEOS_RELEASE_BOARD=arm-generic\n" |
114 "CHROMEOS_RELEASE_FOO=bar\n" | 115 "CHROMEOS_RELEASE_FOO=bar\n" |
115 "CHROMEOS_RELEASE_VERSION=0.2.2.3\n" | 116 "CHROMEOS_RELEASE_VERSION=0.2.2.3\n" |
116 "CHROMEOS_RELEASE_TRACK=footrack")); | 117 "CHROMEOS_RELEASE_TRACK=footrack")); |
117 UpdateCheckParams out; | 118 UpdateCheckParams out; |
118 EXPECT_TRUE(DoTest(false, &out)); | 119 EXPECT_TRUE(DoTest(false, &out)); |
119 EXPECT_TRUE(IsValidGuid(out.machine_id)) << "id: " << out.machine_id; | 120 EXPECT_TRUE(IsValidGuid(out.machine_id)) << "id: " << out.machine_id; |
120 // for now we're just using the machine id here | 121 // for now we're just using the machine id here |
121 EXPECT_TRUE(IsValidGuid(out.user_id)) << "id: " << out.user_id; | 122 EXPECT_TRUE(IsValidGuid(out.user_id)) << "id: " << out.user_id; |
122 EXPECT_EQ("Chrome OS", out.os_platform); | 123 EXPECT_EQ("Chrome OS", out.os_platform); |
123 EXPECT_EQ(string("0.2.2.3_") + GetMachineType(), out.os_sp); | 124 EXPECT_EQ(string("0.2.2.3_") + GetMachineType(), out.os_sp); |
| 125 EXPECT_EQ("arm-generic", out.os_board); |
124 EXPECT_EQ("{87efface-864d-49a5-9bb3-4b050a7c227a}", out.app_id); | 126 EXPECT_EQ("{87efface-864d-49a5-9bb3-4b050a7c227a}", out.app_id); |
125 EXPECT_EQ("0.2.2.3", out.app_version); | 127 EXPECT_EQ("0.2.2.3", out.app_version); |
126 EXPECT_EQ("en-US", out.app_lang); | 128 EXPECT_EQ("en-US", out.app_lang); |
127 EXPECT_EQ("footrack", out.app_track); | 129 EXPECT_EQ("footrack", out.app_track); |
128 } | 130 } |
129 EXPECT_EQ(0, System(string("rm -rf ") + kTestDir)); | 131 EXPECT_EQ(0, System(string("rm -rf ") + kTestDir)); |
130 } | 132 } |
131 | 133 |
132 TEST_F(OmahaRequestPrepActionTest, MissingTrackTest) { | 134 TEST_F(OmahaRequestPrepActionTest, MissingTrackTest) { |
133 ASSERT_EQ(0, System(string("mkdir -p ") + kTestDir + "/etc")); | 135 ASSERT_EQ(0, System(string("mkdir -p ") + kTestDir + "/etc")); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 utils::kStatefulPartition + "/etc/omaha_id", | 198 utils::kStatefulPartition + "/etc/omaha_id", |
197 &machine_id)); | 199 &machine_id)); |
198 EXPECT_EQ(machine_id, out1.machine_id); | 200 EXPECT_EQ(machine_id, out1.machine_id); |
199 UpdateCheckParams out2; | 201 UpdateCheckParams out2; |
200 EXPECT_TRUE(DoTest(false, &out2)); | 202 EXPECT_TRUE(DoTest(false, &out2)); |
201 EXPECT_EQ(machine_id, out2.machine_id); | 203 EXPECT_EQ(machine_id, out2.machine_id); |
202 EXPECT_EQ(0, System(string("rm -rf ") + kTestDir)); | 204 EXPECT_EQ(0, System(string("rm -rf ") + kTestDir)); |
203 } | 205 } |
204 | 206 |
205 } // namespace chromeos_update_engine | 207 } // namespace chromeos_update_engine |
OLD | NEW |