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 <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 Loading... |
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(string(utils::kStatefulPartition) + | |
97 "/the_update_a.b.c.d_FULL_.tgz", | |
98 install_plan.download_path); | |
99 EXPECT_EQ("/dev/sda2", install_plan.install_path); | 96 EXPECT_EQ("/dev/sda2", install_plan.install_path); |
100 } | 97 } |
101 { | 98 { |
102 UpdateCheckResponse in; | 99 UpdateCheckResponse in; |
103 in.update_exists = true; | 100 in.update_exists = true; |
104 in.display_version = "a.b.c.d"; | 101 in.display_version = "a.b.c.d"; |
105 in.codebase = "http://foo/the_update_a.b.c.d_DELTA_.tgz"; | 102 in.codebase = "http://foo/the_update_a.b.c.d_DELTA_.tgz"; |
106 in.more_info_url = "http://more/info"; | 103 in.more_info_url = "http://more/info"; |
107 in.hash = "HASHj+"; | 104 in.hash = "HASHj+"; |
108 in.size = 12; | 105 in.size = 12; |
109 in.needs_admin = true; | 106 in.needs_admin = true; |
110 in.prompt = true; | 107 in.prompt = true; |
111 InstallPlan install_plan; | 108 InstallPlan install_plan; |
112 EXPECT_TRUE(DoTest(in, "/dev/sda4", &install_plan)); | 109 EXPECT_TRUE(DoTest(in, "/dev/sda4", &install_plan)); |
113 EXPECT_FALSE(install_plan.is_full_update); | 110 EXPECT_FALSE(install_plan.is_full_update); |
114 EXPECT_EQ(in.codebase, install_plan.download_url); | 111 EXPECT_EQ(in.codebase, install_plan.download_url); |
115 EXPECT_EQ(in.hash, install_plan.download_hash); | 112 EXPECT_EQ(in.hash, install_plan.download_hash); |
116 EXPECT_EQ(string(utils::kStatefulPartition) + | |
117 "/the_update_a.b.c.d_DELTA_.tgz", | |
118 install_plan.download_path); | |
119 EXPECT_EQ("/dev/sda3", install_plan.install_path); | 113 EXPECT_EQ("/dev/sda3", install_plan.install_path); |
120 } | 114 } |
121 { | 115 { |
122 UpdateCheckResponse in; | 116 UpdateCheckResponse in; |
123 in.update_exists = true; | 117 in.update_exists = true; |
124 in.display_version = "a.b.c.d"; | 118 in.display_version = "a.b.c.d"; |
125 in.codebase = kLongName; | 119 in.codebase = kLongName; |
126 in.more_info_url = "http://more/info"; | 120 in.more_info_url = "http://more/info"; |
127 in.hash = "HASHj+"; | 121 in.hash = "HASHj+"; |
128 in.size = 12; | 122 in.size = 12; |
129 in.needs_admin = true; | 123 in.needs_admin = true; |
130 in.prompt = true; | 124 in.prompt = true; |
131 InstallPlan install_plan; | 125 InstallPlan install_plan; |
132 EXPECT_TRUE(DoTest(in, "/dev/sda4", &install_plan)); | 126 EXPECT_TRUE(DoTest(in, "/dev/sda4", &install_plan)); |
133 EXPECT_FALSE(install_plan.is_full_update); | 127 EXPECT_FALSE(install_plan.is_full_update); |
134 EXPECT_EQ(in.codebase, install_plan.download_url); | 128 EXPECT_EQ(in.codebase, install_plan.download_url); |
135 EXPECT_EQ(in.hash, install_plan.download_hash); | 129 EXPECT_EQ(in.hash, install_plan.download_hash); |
136 EXPECT_EQ(string(utils::kStatefulPartition) + "/" + | |
137 kLongName.substr(0, 255), | |
138 install_plan.download_path); | |
139 EXPECT_EQ("/dev/sda3", install_plan.install_path); | 130 EXPECT_EQ("/dev/sda3", install_plan.install_path); |
140 } | 131 } |
141 } | 132 } |
142 | 133 |
143 TEST_F(OmahaResponseHandlerActionTest, NoUpdatesTest) { | 134 TEST_F(OmahaResponseHandlerActionTest, NoUpdatesTest) { |
144 UpdateCheckResponse in; | 135 UpdateCheckResponse in; |
145 in.update_exists = false; | 136 in.update_exists = false; |
146 InstallPlan install_plan; | 137 InstallPlan install_plan; |
147 EXPECT_FALSE(DoTest(in, "/dev/sda1", &install_plan)); | 138 EXPECT_FALSE(DoTest(in, "/dev/sda1", &install_plan)); |
148 EXPECT_FALSE(install_plan.is_full_update); | 139 EXPECT_FALSE(install_plan.is_full_update); |
149 EXPECT_EQ("", install_plan.download_url); | 140 EXPECT_EQ("", install_plan.download_url); |
150 EXPECT_EQ("", install_plan.download_hash); | 141 EXPECT_EQ("", install_plan.download_hash); |
151 EXPECT_EQ("", install_plan.download_path); | |
152 EXPECT_EQ("", install_plan.install_path); | 142 EXPECT_EQ("", install_plan.install_path); |
153 } | 143 } |
154 | 144 |
155 } // namespace chromeos_update_engine | 145 } // namespace chromeos_update_engine |
OLD | NEW |