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

Side by Side Diff: src/platform/update_engine/omaha_response_handler_action_unittest.cc

Issue 492008: AU: Try delta updates first, then full updates (Closed)
Patch Set: use mkstemp Created 11 years 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
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 <string> 5 #include <string>
6 #include <gtest/gtest.h> 6 #include <gtest/gtest.h>
7 #include "update_engine/omaha_response_handler_action.h" 7 #include "update_engine/omaha_response_handler_action.h"
8 #include "update_engine/test_utils.h" 8 #include "update_engine/test_utils.h"
9 #include "update_engine/utils.h" 9 #include "update_engine/utils.h"
10 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 in.more_info_url = "http://more/info"; 86 in.more_info_url = "http://more/info";
87 in.hash = "HASH+"; 87 in.hash = "HASH+";
88 in.size = 12; 88 in.size = 12;
89 in.needs_admin = true; 89 in.needs_admin = true;
90 in.prompt = false; 90 in.prompt = false;
91 InstallPlan install_plan; 91 InstallPlan install_plan;
92 EXPECT_TRUE(DoTest(in, "/dev/sda1", &install_plan)); 92 EXPECT_TRUE(DoTest(in, "/dev/sda1", &install_plan));
93 EXPECT_TRUE(install_plan.is_full_update); 93 EXPECT_TRUE(install_plan.is_full_update);
94 EXPECT_EQ(in.codebase, install_plan.download_url); 94 EXPECT_EQ(in.codebase, install_plan.download_url);
95 EXPECT_EQ(in.hash, install_plan.download_hash); 95 EXPECT_EQ(in.hash, install_plan.download_hash);
96 EXPECT_EQ(utils::kStatefulPartition + "/the_update_a.b.c.d_FULL_.tgz", 96 EXPECT_EQ(string(utils::kStatefulPartition) +
97 "/the_update_a.b.c.d_FULL_.tgz",
97 install_plan.download_path); 98 install_plan.download_path);
98 EXPECT_EQ("/dev/sda2", install_plan.install_path); 99 EXPECT_EQ("/dev/sda2", install_plan.install_path);
99 } 100 }
100 { 101 {
101 UpdateCheckResponse in; 102 UpdateCheckResponse in;
102 in.update_exists = true; 103 in.update_exists = true;
103 in.display_version = "a.b.c.d"; 104 in.display_version = "a.b.c.d";
104 in.codebase = "http://foo/the_update_a.b.c.d_DELTA_.tgz"; 105 in.codebase = "http://foo/the_update_a.b.c.d_DELTA_.tgz";
105 in.more_info_url = "http://more/info"; 106 in.more_info_url = "http://more/info";
106 in.hash = "HASHj+"; 107 in.hash = "HASHj+";
107 in.size = 12; 108 in.size = 12;
108 in.needs_admin = true; 109 in.needs_admin = true;
109 in.prompt = true; 110 in.prompt = true;
110 InstallPlan install_plan; 111 InstallPlan install_plan;
111 EXPECT_TRUE(DoTest(in, "/dev/sda4", &install_plan)); 112 EXPECT_TRUE(DoTest(in, "/dev/sda4", &install_plan));
112 EXPECT_FALSE(install_plan.is_full_update); 113 EXPECT_FALSE(install_plan.is_full_update);
113 EXPECT_EQ(in.codebase, install_plan.download_url); 114 EXPECT_EQ(in.codebase, install_plan.download_url);
114 EXPECT_EQ(in.hash, install_plan.download_hash); 115 EXPECT_EQ(in.hash, install_plan.download_hash);
115 EXPECT_EQ(utils::kStatefulPartition + "/the_update_a.b.c.d_DELTA_.tgz", 116 EXPECT_EQ(string(utils::kStatefulPartition) +
117 "/the_update_a.b.c.d_DELTA_.tgz",
116 install_plan.download_path); 118 install_plan.download_path);
117 EXPECT_EQ("/dev/sda3", install_plan.install_path); 119 EXPECT_EQ("/dev/sda3", install_plan.install_path);
118 } 120 }
119 { 121 {
120 UpdateCheckResponse in; 122 UpdateCheckResponse in;
121 in.update_exists = true; 123 in.update_exists = true;
122 in.display_version = "a.b.c.d"; 124 in.display_version = "a.b.c.d";
123 in.codebase = kLongName; 125 in.codebase = kLongName;
124 in.more_info_url = "http://more/info"; 126 in.more_info_url = "http://more/info";
125 in.hash = "HASHj+"; 127 in.hash = "HASHj+";
126 in.size = 12; 128 in.size = 12;
127 in.needs_admin = true; 129 in.needs_admin = true;
128 in.prompt = true; 130 in.prompt = true;
129 InstallPlan install_plan; 131 InstallPlan install_plan;
130 EXPECT_TRUE(DoTest(in, "/dev/sda4", &install_plan)); 132 EXPECT_TRUE(DoTest(in, "/dev/sda4", &install_plan));
131 EXPECT_FALSE(install_plan.is_full_update); 133 EXPECT_FALSE(install_plan.is_full_update);
132 EXPECT_EQ(in.codebase, install_plan.download_url); 134 EXPECT_EQ(in.codebase, install_plan.download_url);
133 EXPECT_EQ(in.hash, install_plan.download_hash); 135 EXPECT_EQ(in.hash, install_plan.download_hash);
134 EXPECT_EQ(utils::kStatefulPartition + "/" + kLongName.substr(0, 255), 136 EXPECT_EQ(string(utils::kStatefulPartition) + "/" +
137 kLongName.substr(0, 255),
135 install_plan.download_path); 138 install_plan.download_path);
136 EXPECT_EQ("/dev/sda3", install_plan.install_path); 139 EXPECT_EQ("/dev/sda3", install_plan.install_path);
137 } 140 }
138 } 141 }
139 142
140 TEST_F(OmahaResponseHandlerActionTest, NoUpdatesTest) { 143 TEST_F(OmahaResponseHandlerActionTest, NoUpdatesTest) {
141 UpdateCheckResponse in; 144 UpdateCheckResponse in;
142 in.update_exists = false; 145 in.update_exists = false;
143 InstallPlan install_plan; 146 InstallPlan install_plan;
144 EXPECT_FALSE(DoTest(in, "/dev/sda1", &install_plan)); 147 EXPECT_FALSE(DoTest(in, "/dev/sda1", &install_plan));
145 EXPECT_FALSE(install_plan.is_full_update); 148 EXPECT_FALSE(install_plan.is_full_update);
146 EXPECT_EQ("", install_plan.download_url); 149 EXPECT_EQ("", install_plan.download_url);
147 EXPECT_EQ("", install_plan.download_hash); 150 EXPECT_EQ("", install_plan.download_hash);
148 EXPECT_EQ("", install_plan.download_path); 151 EXPECT_EQ("", install_plan.download_path);
149 EXPECT_EQ("", install_plan.install_path); 152 EXPECT_EQ("", install_plan.install_path);
150 } 153 }
151 154
152 } // namespace chromeos_update_engine 155 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « src/platform/update_engine/omaha_response_handler_action.cc ('k') | src/platform/update_engine/postinstall_runner_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698