~ubuntu-branches/ubuntu/vivid/mir/vivid

« back to all changes in this revision

Viewing changes to tests/mir_test_doubles/mock_frame_dropping_policy_factory.cpp

  • Committer: Package Import Robot
  • Author(s): CI Train Bot, Alberto Aguirre
  • Date: 2015-02-24 23:02:25 UTC
  • mfrom: (1.1.83)
  • Revision ID: package-import@ubuntu.com-20150224230225-82gzgkl7g1zbjrm5
Tags: 0.12.0+15.04.20150224.1-0ubuntu1
[ Alberto Aguirre ]
* New upstream release 0.12.0 (https://launchpad.net/mir/+milestone/0.12.0)
  - Packaging changes:
    . Client platform packages now include the Mir client platform ABI 
      number. Thusly, mir-client-platform-(mesa|android) is replaced by 
      mir-client-platform-(mesa|android)2
    . Server graphics platform packages now include the Mir graphics
      platform ABI number. Thusly, mir-platform-graphics-(mesa|android)
      is replaced by mir-platform-graphics-(mesa|android)1
  - ABI summary: Servers need rebuilding, but clients do not;
    . Mirclient ABI unchanged at 8
    . Mircommon ABI unchanged at 3
    . Mirplatform ABI unchanged at 6
    . Mirserver ABI bumped to 30
  - Bug fixes:
    . [regression] Platform libraries and packages are not versioned thus
      are not installable in parallel (LP: #1423591)
    . [regression] Deadlock in TimeoutFrameDroppingPolicy logic (LP: #1421255)
 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright © 2014 Canonical Ltd.
 
2
 * Copyright © 2014-2015 Canonical Ltd.
3
3
 *
4
4
 * This program is free software: you can redistribute it and/or modify it
5
5
 * under the terms of the GNU General Public License version 3,
14
14
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
15
 *
16
16
 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
 
17
 *              Alberto Aguirre <alberto.aguirre@canonical.com>
17
18
 */
18
19
 
19
20
#include "mir_test_doubles/mock_frame_dropping_policy_factory.h"
21
22
namespace mc = mir::compositor;
22
23
namespace mtd = mir::test::doubles;
23
24
 
24
 
mtd::MockFrameDroppingPolicy::MockFrameDroppingPolicy(std::function<void(void)> callback,
 
25
mtd::MockFrameDroppingPolicy::MockFrameDroppingPolicy(std::function<void()> const& callback,
 
26
                                                      std::function<void()> const& lock,
 
27
                                                      std::function<void()> const& unlock,
25
28
                                                      MockFrameDroppingPolicyFactory const* parent)
26
29
        : callback{callback},
 
30
          lock{lock},
 
31
          unlock{unlock},
27
32
          parent{parent}
28
33
{
29
34
}
36
41
 
37
42
void mtd::MockFrameDroppingPolicy::trigger()
38
43
{
 
44
    lock();
39
45
    callback();
 
46
    unlock();
40
47
}
41
48
 
42
49
void mtd::MockFrameDroppingPolicy::parent_destroyed()
45
52
}
46
53
 
47
54
std::unique_ptr<mc::FrameDroppingPolicy>
48
 
mtd::MockFrameDroppingPolicyFactory::create_policy(std::function<void(void)> drop_frame) const
 
55
mtd::MockFrameDroppingPolicyFactory::create_policy(std::function<void()> const& drop_frame,
 
56
    std::function<void()> const& lock, std::function<void()> const& unlock) const
49
57
{
50
 
    auto policy = new ::testing::NiceMock<MockFrameDroppingPolicy>{drop_frame, this};
 
58
    auto policy = new ::testing::NiceMock<MockFrameDroppingPolicy>{drop_frame, lock, unlock, this};
51
59
    policies.insert(policy);
52
60
    return std::unique_ptr<mc::FrameDroppingPolicy>{policy};
53
61
}