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

Side by Side Diff: chrome/installer/util/callback_work_item_unittest.cc

Issue 10916018: Force COM machinery to notice that the path to the DelegateExecute verb handler has changed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed robert's comments Created 8 years, 3 months 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
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/bind.h"
6 #include "chrome/installer/util/callback_work_item.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace {
10
11 // A callback that always fails (returns false).
12 bool TestFailureCallback(const CallbackWorkItem& work_item) {
13 return false;
14 }
15
16 } // namespace
17
18 // Test that the work item returns false when a callback returns failure.
19 TEST(CallbackWorkItemTest, TestFailure) {
20 CallbackWorkItem work_item(base::Bind(&TestFailureCallback));
21
22 EXPECT_FALSE(work_item.Do());
23 }
24
25 namespace {
26
27 enum TestCallbackState {
28 TCS_UNDEFINED,
29 TCS_CALLED_FORWARD,
30 TCS_CALLED_ROLLBACK,
31 };
32
33 // A callback that sets |state| according to whether it is rolling forward or
34 // backward.
35 bool TestForwardBackwardCallback(TestCallbackState* state,
36 const CallbackWorkItem& work_item) {
37 *state = work_item.IsRollback() ? TCS_CALLED_ROLLBACK : TCS_CALLED_FORWARD;
38 return true;
39 }
40
41 } // namespace
42
43 // Test that the callback is invoked correclty during Do() and Rollback().
44 TEST(CallbackWorkItemTest, TestForwardBackward) {
45 TestCallbackState state = TCS_UNDEFINED;
46
47 CallbackWorkItem work_item(base::Bind(&TestForwardBackwardCallback, &state));
48
49 EXPECT_TRUE(work_item.Do());
50 EXPECT_EQ(TCS_CALLED_FORWARD, state);
51
52 work_item.Rollback();
53 EXPECT_EQ(TCS_CALLED_ROLLBACK, state);
54 }
OLDNEW
« no previous file with comments | « chrome/installer/util/callback_work_item.cc ('k') | chrome/installer/util/chromium_binaries_distribution.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698