| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 { | 81 { |
| 82 OmahaResponse in; | 82 OmahaResponse in; |
| 83 in.update_exists = true; | 83 in.update_exists = true; |
| 84 in.display_version = "a.b.c.d"; | 84 in.display_version = "a.b.c.d"; |
| 85 in.codebase = "http://foo/the_update_a.b.c.d.tgz"; | 85 in.codebase = "http://foo/the_update_a.b.c.d.tgz"; |
| 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 in.is_delta = false; |
| 91 InstallPlan install_plan; | 92 InstallPlan install_plan; |
| 92 EXPECT_TRUE(DoTest(in, "/dev/sda3", &install_plan)); | 93 EXPECT_TRUE(DoTest(in, "/dev/sda3", &install_plan)); |
| 93 EXPECT_TRUE(install_plan.is_full_update); | 94 EXPECT_TRUE(install_plan.is_full_update); |
| 94 EXPECT_EQ(in.codebase, install_plan.download_url); | 95 EXPECT_EQ(in.codebase, install_plan.download_url); |
| 95 EXPECT_EQ(in.hash, install_plan.download_hash); | 96 EXPECT_EQ(in.hash, install_plan.download_hash); |
| 96 EXPECT_EQ("/dev/sda5", install_plan.install_path); | 97 EXPECT_EQ("/dev/sda5", install_plan.install_path); |
| 97 } | 98 } |
| 98 { | 99 { |
| 99 OmahaResponse in; | 100 OmahaResponse in; |
| 100 in.update_exists = true; | 101 in.update_exists = true; |
| 101 in.display_version = "a.b.c.d"; | 102 in.display_version = "a.b.c.d"; |
| 102 in.codebase = "http://foo/the_update_a.b.c.d.tgz"; | 103 in.codebase = "http://foo/the_update_a.b.c.d.tgz"; |
| 103 in.more_info_url = "http://more/info"; | 104 in.more_info_url = "http://more/info"; |
| 104 in.hash = "HASHj+"; | 105 in.hash = "HASHj+"; |
| 105 in.size = 12; | 106 in.size = 12; |
| 106 in.needs_admin = true; | 107 in.needs_admin = true; |
| 107 in.prompt = true; | 108 in.prompt = true; |
| 109 in.is_delta = true; |
| 108 InstallPlan install_plan; | 110 InstallPlan install_plan; |
| 109 EXPECT_TRUE(DoTest(in, "/dev/sda5", &install_plan)); | 111 EXPECT_TRUE(DoTest(in, "/dev/sda5", &install_plan)); |
| 110 EXPECT_TRUE(install_plan.is_full_update); | 112 EXPECT_FALSE(install_plan.is_full_update); |
| 111 EXPECT_EQ(in.codebase, install_plan.download_url); | 113 EXPECT_EQ(in.codebase, install_plan.download_url); |
| 112 EXPECT_EQ(in.hash, install_plan.download_hash); | 114 EXPECT_EQ(in.hash, install_plan.download_hash); |
| 113 EXPECT_EQ("/dev/sda3", install_plan.install_path); | 115 EXPECT_EQ("/dev/sda3", install_plan.install_path); |
| 114 } | 116 } |
| 115 { | 117 { |
| 116 OmahaResponse in; | 118 OmahaResponse in; |
| 117 in.update_exists = true; | 119 in.update_exists = true; |
| 118 in.display_version = "a.b.c.d"; | 120 in.display_version = "a.b.c.d"; |
| 119 in.codebase = kLongName; | 121 in.codebase = kLongName; |
| 120 in.more_info_url = "http://more/info"; | 122 in.more_info_url = "http://more/info"; |
| 121 in.hash = "HASHj+"; | 123 in.hash = "HASHj+"; |
| 122 in.size = 12; | 124 in.size = 12; |
| 123 in.needs_admin = true; | 125 in.needs_admin = true; |
| 124 in.prompt = true; | 126 in.prompt = true; |
| 127 in.is_delta = false; |
| 125 InstallPlan install_plan; | 128 InstallPlan install_plan; |
| 126 EXPECT_TRUE(DoTest(in, "/dev/sda3", &install_plan)); | 129 EXPECT_TRUE(DoTest(in, "/dev/sda3", &install_plan)); |
| 127 EXPECT_TRUE(install_plan.is_full_update); | 130 EXPECT_TRUE(install_plan.is_full_update); |
| 128 EXPECT_EQ(in.codebase, install_plan.download_url); | 131 EXPECT_EQ(in.codebase, install_plan.download_url); |
| 129 EXPECT_EQ(in.hash, install_plan.download_hash); | 132 EXPECT_EQ(in.hash, install_plan.download_hash); |
| 130 EXPECT_EQ("/dev/sda5", install_plan.install_path); | 133 EXPECT_EQ("/dev/sda5", install_plan.install_path); |
| 131 } | 134 } |
| 132 } | 135 } |
| 133 | 136 |
| 134 TEST_F(OmahaResponseHandlerActionTest, NoUpdatesTest) { | 137 TEST_F(OmahaResponseHandlerActionTest, NoUpdatesTest) { |
| 135 OmahaResponse in; | 138 OmahaResponse in; |
| 136 in.update_exists = false; | 139 in.update_exists = false; |
| 137 InstallPlan install_plan; | 140 InstallPlan install_plan; |
| 138 EXPECT_FALSE(DoTest(in, "/dev/sda1", &install_plan)); | 141 EXPECT_FALSE(DoTest(in, "/dev/sda1", &install_plan)); |
| 139 EXPECT_FALSE(install_plan.is_full_update); | 142 EXPECT_FALSE(install_plan.is_full_update); |
| 140 EXPECT_EQ("", install_plan.download_url); | 143 EXPECT_EQ("", install_plan.download_url); |
| 141 EXPECT_EQ("", install_plan.download_hash); | 144 EXPECT_EQ("", install_plan.download_hash); |
| 142 EXPECT_EQ("", install_plan.install_path); | 145 EXPECT_EQ("", install_plan.install_path); |
| 143 } | 146 } |
| 144 | 147 |
| 145 } // namespace chromeos_update_engine | 148 } // namespace chromeos_update_engine |
| OLD | NEW |