~ps-jenkins/indicator-transfer/ubuntu-vivid-proposed

« back to all changes in this revision

Viewing changes to tests/test-actions-live.cpp

  • Committer: Charles Kerr
  • Date: 2014-03-31 02:21:02 UTC
  • mto: (1.2.1 draft-2)
  • mto: This revision was merged to the branch mainline in revision 2.
  • Revision ID: charles.kerr@canonical.com-20140331022102-aakhmppqos4w81i3
get the test coverage reports working

Show diffs side-by-side

added added

removed removed

Lines of Context:
135
135
 
136
136
TEST_F(ActionsFixture, Activate)
137
137
{
138
 
    // FIXME: states
 
138
    std::vector<MockTransfer::Action> expected_history;
 
139
    EXPECT_EQ(expected_history, m_transfer_a->history());
 
140
 
 
141
    m_live_actions->activate(m_transfer_a->id());
 
142
    expected_history.push_back(MockTransfer::Pause);
 
143
    EXPECT_EQ(expected_history, m_transfer_a->history());
 
144
 
 
145
    m_live_actions->activate(m_transfer_a->id());
 
146
    expected_history.push_back(MockTransfer::Resume);
 
147
    EXPECT_EQ(expected_history, m_transfer_a->history());
 
148
 
 
149
    m_transfer_a->state().set(Transfer::DONE);
 
150
    m_live_actions->activate(m_transfer_a->id());
 
151
    expected_history.push_back(MockTransfer::Open);
 
152
    EXPECT_EQ(expected_history, m_transfer_a->history());
 
153
 
 
154
    m_transfer_a->state().set(Transfer::CANCELING);
 
155
    m_live_actions->activate(m_transfer_a->id());
 
156
    expected_history.push_back(MockTransfer::Clear);
 
157
    EXPECT_EQ(expected_history, m_transfer_a->history());
 
158
}
 
159
 
 
160
TEST_F(ActionsFixture, InvalidId)
 
161
{
 
162
    EXPECT_EQ(empty_history, m_transfer_a->history());
 
163
    EXPECT_EQ(empty_history, m_transfer_b->history());
 
164
 
 
165
    m_live_actions->pause("unknown-id");
 
166
    increment_expected_errors(G_LOG_LEVEL_CRITICAL);
 
167
    EXPECT_EQ(empty_history, m_transfer_a->history());
 
168
    EXPECT_EQ(empty_history, m_transfer_b->history());
 
169
 
 
170
    m_live_actions->resume("unknown-id");
 
171
    increment_expected_errors(G_LOG_LEVEL_CRITICAL);
 
172
    EXPECT_EQ(empty_history, m_transfer_a->history());
 
173
    EXPECT_EQ(empty_history, m_transfer_b->history());
 
174
 
 
175
    m_live_actions->cancel("unknown-id");
 
176
    increment_expected_errors(G_LOG_LEVEL_CRITICAL);
 
177
    EXPECT_EQ(empty_history, m_transfer_a->history());
 
178
    EXPECT_EQ(empty_history, m_transfer_b->history());
 
179
 
 
180
    m_live_actions->resume("unknown-id");
 
181
    increment_expected_errors(G_LOG_LEVEL_CRITICAL);
 
182
    EXPECT_EQ(empty_history, m_transfer_a->history());
 
183
    EXPECT_EQ(empty_history, m_transfer_b->history());
139
184
}