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

Side by Side Diff: omaha_request_params_unittest.cc

Issue 5022001: AU: Allow override of "appid" through the lsb-release file. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git@master
Patch Set: Created 10 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « omaha_request_params.cc ('k') | no next file » | 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) 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 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "gtest/gtest.h" 10 #include "gtest/gtest.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 EXPECT_EQ("arm-generic", out.os_board); 89 EXPECT_EQ("arm-generic", out.os_board);
90 EXPECT_EQ("{87efface-864d-49a5-9bb3-4b050a7c227a}", out.app_id); 90 EXPECT_EQ("{87efface-864d-49a5-9bb3-4b050a7c227a}", out.app_id);
91 EXPECT_EQ("0.2.2.3", out.app_version); 91 EXPECT_EQ("0.2.2.3", out.app_version);
92 EXPECT_EQ("en-US", out.app_lang); 92 EXPECT_EQ("en-US", out.app_lang);
93 EXPECT_EQ("", out.hardware_class); 93 EXPECT_EQ("", out.hardware_class);
94 EXPECT_TRUE(out.delta_okay); 94 EXPECT_TRUE(out.delta_okay);
95 EXPECT_EQ("footrack", out.app_track); 95 EXPECT_EQ("footrack", out.app_track);
96 EXPECT_EQ("http://www.google.com", out.update_url); 96 EXPECT_EQ("http://www.google.com", out.update_url);
97 } 97 }
98 98
99 TEST_F(OmahaRequestDeviceParamsTest, AppIDTest) {
100 ASSERT_TRUE(WriteFileString(
101 kTestDir + "/etc/lsb-release",
102 "CHROMEOS_RELEASE_BOARD=arm-generic\n"
103 "CHROMEOS_RELEASE_FOO=bar\n"
104 "CHROMEOS_RELEASE_VERSION=0.2.2.3\n"
105 "CHROMEOS_RELEASE_TRACK=footrack\n"
106 "CHROMEOS_RELEASE_APPID={58c35cef-9d30-476e-9098-ce20377d535d}\n"
107 "CHROMEOS_AUSERVER=http://www.google.com"));
108 OmahaRequestParams out;
109 EXPECT_TRUE(DoTest(&out, "", ""));
110 EXPECT_EQ("Chrome OS", out.os_platform);
111 EXPECT_EQ(string("0.2.2.3_") + GetMachineType(), out.os_sp);
112 EXPECT_EQ("arm-generic", out.os_board);
113 EXPECT_EQ("{58c35cef-9d30-476e-9098-ce20377d535d}", out.app_id);
114 EXPECT_EQ("0.2.2.3", out.app_version);
115 EXPECT_EQ("en-US", out.app_lang);
116 EXPECT_EQ("", out.hardware_class);
117 EXPECT_TRUE(out.delta_okay);
118 EXPECT_EQ("footrack", out.app_track);
119 EXPECT_EQ("http://www.google.com", out.update_url);
120 }
121
99 TEST_F(OmahaRequestDeviceParamsTest, MissingTrackTest) { 122 TEST_F(OmahaRequestDeviceParamsTest, MissingTrackTest) {
100 ASSERT_TRUE(WriteFileString( 123 ASSERT_TRUE(WriteFileString(
101 kTestDir + "/etc/lsb-release", 124 kTestDir + "/etc/lsb-release",
102 "CHROMEOS_RELEASE_FOO=bar\n" 125 "CHROMEOS_RELEASE_FOO=bar\n"
103 "CHROMEOS_RELEASE_VERSION=0.2.2.3\n" 126 "CHROMEOS_RELEASE_VERSION=0.2.2.3\n"
104 "CHROMEOS_RELEASE_TRXCK=footrack")); 127 "CHROMEOS_RELEASE_TRXCK=footrack"));
105 OmahaRequestParams out; 128 OmahaRequestParams out;
106 EXPECT_TRUE(DoTest(&out, "", "")); 129 EXPECT_TRUE(DoTest(&out, "", ""));
107 EXPECT_EQ("Chrome OS", out.os_platform); 130 EXPECT_EQ("Chrome OS", out.os_platform);
108 EXPECT_EQ(string("0.2.2.3_") + GetMachineType(), out.os_sp); 131 EXPECT_EQ(string("0.2.2.3_") + GetMachineType(), out.os_sp);
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 EXPECT_EQ("{87efface-864d-49a5-9bb3-4b050a7c227a}", out.app_id); 401 EXPECT_EQ("{87efface-864d-49a5-9bb3-4b050a7c227a}", out.app_id);
379 EXPECT_EQ("0.2.2.3", out.app_version); 402 EXPECT_EQ("0.2.2.3", out.app_version);
380 EXPECT_EQ("en-US", out.app_lang); 403 EXPECT_EQ("en-US", out.app_lang);
381 EXPECT_EQ("", out.hardware_class); 404 EXPECT_EQ("", out.hardware_class);
382 EXPECT_TRUE(out.delta_okay); 405 EXPECT_TRUE(out.delta_okay);
383 EXPECT_EQ("dev-channel", out.app_track); 406 EXPECT_EQ("dev-channel", out.app_track);
384 EXPECT_EQ("http://www.google.com", out.update_url); 407 EXPECT_EQ("http://www.google.com", out.update_url);
385 } 408 }
386 409
387 } // namespace chromeos_update_engine 410 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « omaha_request_params.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698