~ubuntu-branches/ubuntu/trusty/unity-scopes-api/trusty-proposed

« back to all changes in this revision

Viewing changes to test/gtest/scopes/Activation/TestScope.h

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Pawel Stolowski
  • Date: 2014-02-11 17:55:05 UTC
  • mfrom: (1.1.8)
  • Revision ID: package-import@ubuntu.com-20140211175505-av3z0612p7o8w54b
Tags: 0.3.1+14.04.20140211.2-0ubuntu1
[ Pawel Stolowski ]
* [ Pawel Stolowski ]
* Added preliminary API for filters and departments.
* Changes to preview action activation API: support for widget id.
* Changes to Annotation API.
* Return ScopeProxy from Result::target_scope_proxy (replaces activation_scope_name).

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
class TestActivation : public ActivationBase
53
53
{
54
54
public:
55
 
    TestActivation(std::string const& hint, std::string const& hint_val, std::string const &uri, VariantMap const& hints)
 
55
    TestActivation(std::string const& hint, std::string const& hint_val, std::string const &uri, Variant const& hints)
56
56
        : hint_key_(hint),
57
57
          hint_val_(hint_val),
58
58
          uri_(uri),
62
62
 
63
63
    virtual ActivationResponse activate() override
64
64
    {
65
 
        ActivationResponse resp(ActivationResponse::Status::Handled);
 
65
        ActivationResponse resp(ActivationResponse::Status::ShowDash);
66
66
        VariantMap var;
67
67
        var[hint_key_] = hint_val_;
68
68
        var["received_hints"] = recv_hints_; // send received hints back for testing
75
75
    std::string hint_key_;
76
76
    std::string hint_val_;
77
77
    std::string uri_;
78
 
    VariantMap recv_hints_;
 
78
    Variant recv_hints_;
79
79
};
80
80
 
81
81
class TestScope : public ScopeBase
90
90
 
91
91
    virtual void run() override {}
92
92
 
93
 
    virtual QueryBase::UPtr create_query(std::string const &, VariantMap const &) override
 
93
    virtual QueryBase::UPtr create_query(Query const &, SearchMetadata const &) override
94
94
    {
95
95
        return QueryBase::UPtr(new TestQuery());
96
96
    }
97
97
 
98
 
    virtual QueryBase::UPtr preview(Result const&, VariantMap const &) override
 
98
    virtual QueryBase::UPtr preview(Result const&, ActionMetadata const &) override
99
99
    {
100
100
        return nullptr;
101
101
    }
102
102
 
103
 
    virtual ActivationBase::UPtr activate(Result const& result, VariantMap const& hints) override
 
103
    virtual ActivationBase::UPtr activate(Result const& result, ActionMetadata const& hints) override
104
104
    {
105
 
        return ActivationBase::UPtr(new TestActivation("foo", "bar", result.uri(), hints));
 
105
        return ActivationBase::UPtr(new TestActivation("foo", "bar", result.uri(), hints.scope_data()));
106
106
    }
107
107
 
108
 
    virtual ActivationBase::UPtr activate_preview_action(Result const& result, VariantMap const& hints, std::string const& action_id) override
 
108
    virtual ActivationBase::UPtr perform_action(Result const& result, ActionMetadata const& hints, std::string const& widget_id, std::string const& action_id) override
109
109
    {
110
 
        return ActivationBase::UPtr(new TestActivation("activated action id", action_id, result.uri(), hints));
 
110
        return ActivationBase::UPtr(new TestActivation("activated action", widget_id + action_id, result.uri(), hints.scope_data()));
111
111
    }
112
112
};
113
113