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