Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: omaha_request_prep_action_unittest.cc

Issue 2827032: AU: Send board (e.g. x86-generic) to update server in query. (Closed) Base URL: ssh://git@chromiumos-git/update_engine.git
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « omaha_request_prep_action.cc ('k') | update_check_action.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « omaha_request_prep_action.cc ('k') | update_check_action.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698