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

Side by Side Diff: omaha_response_handler_action_unittest.cc

Issue 5141004: AU: Use NiceMock<PrefsMock to suppress uninteresting call warnings. (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_action_unittest.cc ('k') | update_attempter_unittest.cc » ('j') | 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 <string> 5 #include <string>
6 6
7 #include <gtest/gtest.h> 7 #include <gtest/gtest.h>
8 8
9 #include "update_engine/omaha_response_handler_action.h" 9 #include "update_engine/omaha_response_handler_action.h"
10 #include "update_engine/prefs_mock.h" 10 #include "update_engine/prefs_mock.h"
11 #include "update_engine/test_utils.h" 11 #include "update_engine/test_utils.h"
12 #include "update_engine/utils.h" 12 #include "update_engine/utils.h"
13 13
14 using std::string; 14 using std::string;
15 using testing::NiceMock;
15 using testing::Return; 16 using testing::Return;
16 17
17 namespace chromeos_update_engine { 18 namespace chromeos_update_engine {
18 19
19 class OmahaResponseHandlerActionTest : public ::testing::Test { 20 class OmahaResponseHandlerActionTest : public ::testing::Test {
20 public: 21 public:
21 // Return true iff the OmahaResponseHandlerAction succeeded. 22 // Return true iff the OmahaResponseHandlerAction succeeded.
22 // If out is non-NULL, it's set w/ the response from the action. 23 // If out is non-NULL, it's set w/ the response from the action.
23 bool DoTest(const OmahaResponse& in, 24 bool DoTest(const OmahaResponse& in,
24 const string& boot_dev, 25 const string& boot_dev,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 58
58 bool OmahaResponseHandlerActionTest::DoTest(const OmahaResponse& in, 59 bool OmahaResponseHandlerActionTest::DoTest(const OmahaResponse& in,
59 const string& boot_dev, 60 const string& boot_dev,
60 InstallPlan* out) { 61 InstallPlan* out) {
61 ActionProcessor processor; 62 ActionProcessor processor;
62 OmahaResponseHandlerActionProcessorDelegate delegate; 63 OmahaResponseHandlerActionProcessorDelegate delegate;
63 processor.set_delegate(&delegate); 64 processor.set_delegate(&delegate);
64 65
65 ObjectFeederAction<OmahaResponse> feeder_action; 66 ObjectFeederAction<OmahaResponse> feeder_action;
66 feeder_action.set_obj(in); 67 feeder_action.set_obj(in);
67 PrefsMock prefs; 68 NiceMock<PrefsMock> prefs;
68 if (in.update_exists) { 69 if (in.update_exists) {
69 EXPECT_CALL(prefs, SetString(kPrefsUpdateCheckResponseHash, in.hash)) 70 EXPECT_CALL(prefs, SetString(kPrefsUpdateCheckResponseHash, in.hash))
70 .WillOnce(Return(true)); 71 .WillOnce(Return(true));
71 } 72 }
72 OmahaResponseHandlerAction response_handler_action(&prefs); 73 OmahaResponseHandlerAction response_handler_action(&prefs);
73 response_handler_action.set_boot_device(boot_dev); 74 response_handler_action.set_boot_device(boot_dev);
74 BondActions(&feeder_action, &response_handler_action); 75 BondActions(&feeder_action, &response_handler_action);
75 ObjectCollectorAction<InstallPlan> collector_action; 76 ObjectCollectorAction<InstallPlan> collector_action;
76 BondActions(&response_handler_action, &collector_action); 77 BondActions(&response_handler_action, &collector_action);
77 processor.EnqueueAction(&feeder_action); 78 processor.EnqueueAction(&feeder_action);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 in.update_exists = false; 172 in.update_exists = false;
172 InstallPlan install_plan; 173 InstallPlan install_plan;
173 EXPECT_FALSE(DoTest(in, "/dev/sda1", &install_plan)); 174 EXPECT_FALSE(DoTest(in, "/dev/sda1", &install_plan));
174 EXPECT_FALSE(install_plan.is_full_update); 175 EXPECT_FALSE(install_plan.is_full_update);
175 EXPECT_EQ("", install_plan.download_url); 176 EXPECT_EQ("", install_plan.download_url);
176 EXPECT_EQ("", install_plan.download_hash); 177 EXPECT_EQ("", install_plan.download_hash);
177 EXPECT_EQ("", install_plan.install_path); 178 EXPECT_EQ("", install_plan.install_path);
178 } 179 }
179 180
180 } // namespace chromeos_update_engine 181 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « omaha_request_action_unittest.cc ('k') | update_attempter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698