~3v1n0/unity/overlay-border-scale

« back to all changes in this revision

Viewing changes to tests/test_utils.h

  • Committer: Daniel van Vugt
  • Date: 2012-03-14 06:24:18 UTC
  • mfrom: (2108 unity)
  • mto: This revision was merged to the branch mainline in revision 2146.
  • Revision ID: daniel.van.vugt@canonical.com-20120314062418-nprucpbr0m7qky5e
MergedĀ latestĀ lp:unity

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
      return FALSE;
23
23
    };
24
24
 
25
 
    guint32 timeout_id = g_timeout_add_seconds(10, timeout_cb, &timeout_reached);
 
25
    guint32 timeout_id = g_timeout_add(10000, timeout_cb, &timeout_reached);
26
26
 
27
27
    while (model.count != n_rows && !timeout_reached)
28
28
    {
48
48
 
49
49
  static guint32 ScheduleTimeout(bool* timeout_reached, unsigned int timeout_duration = 10)
50
50
  {
51
 
    return g_timeout_add_seconds(timeout_duration, TimeoutCallback, timeout_reached);
52
 
  }
 
51
    return g_timeout_add(timeout_duration*1000, TimeoutCallback, timeout_reached);
 
52
  }
 
53
 
 
54
  static guint32 ScheduleTimeoutMSec(bool* timeout_reached, unsigned int timeout_duration = 10)
 
55
  {
 
56
    return g_timeout_add(timeout_duration, TimeoutCallback, timeout_reached);
 
57
  }
 
58
 
 
59
  static void WaitForTimeout(unsigned int timeout_duration = 10)
 
60
  {
 
61
    bool timeout_reached = false;
 
62
    guint32 timeout_id = ScheduleTimeout(&timeout_reached, timeout_duration);
 
63
 
 
64
    while (!timeout_reached)
 
65
      g_main_context_iteration(g_main_context_get_thread_default(), TRUE);
 
66
 
 
67
    g_source_remove(timeout_id);
 
68
  }
 
69
 
 
70
  static void WaitForTimeoutMSec(unsigned int timeout_duration = 10)
 
71
    {
 
72
      bool timeout_reached = false;
 
73
      guint32 timeout_id = ScheduleTimeoutMSec(&timeout_reached, timeout_duration);
 
74
 
 
75
      while (!timeout_reached)
 
76
        g_main_context_iteration(g_main_context_get_thread_default(), TRUE);
 
77
 
 
78
      g_source_remove(timeout_id);
 
79
    }
53
80
 
54
81
private:
55
82
  static gboolean TimeoutCallback(gpointer data)