• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2015 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 package org.chromium.net.test.util;
6 
7 import org.chromium.base.ThreadUtils;
8 
9 import java.util.concurrent.FutureTask;
10 
11 /** A utility class useful for testing NetworkChangeNotifier. */
12 public class NetworkChangeNotifierTestUtil {
13     /** Flushes UI thread task queue. */
flushUiThreadTaskQueue()14     public static void flushUiThreadTaskQueue() throws Exception {
15         FutureTask<Void> task =
16                 new FutureTask<Void>(
17                         new Runnable() {
18                             @Override
19                             public void run() {}
20                         },
21                         null);
22         ThreadUtils.postOnUiThread(task);
23         task.get();
24     }
25 }
26