OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 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.blimp.core; |
| 6 |
| 7 import android.preference.PreferenceFragment; |
| 8 |
| 9 import org.chromium.blimp.core.settings.AboutBlimpPreferences; |
| 10 import org.chromium.blimp.core.settings.BlimpPreferencesDelegate; |
| 11 import org.chromium.blimp_public.BlimpClientContext; |
| 12 import org.chromium.blimp_public.BlimpClientContextDelegate; |
| 13 import org.chromium.blimp_public.contents.BlimpContents; |
| 14 |
| 15 /** |
| 16 * Mock {@link BlimpClientContext}. |
| 17 * This test support class only tests Java layer and is not backed by any native
code. |
| 18 */ |
| 19 public class MockBlimpClientContext implements BlimpClientContext, BlimpPreferen
cesDelegate { |
| 20 public MockBlimpClientContext() {} |
| 21 |
| 22 private MockBlimpClientContextDelegate mDelegate = new MockBlimpClientContex
tDelegate(); |
| 23 |
| 24 private boolean mEnabled = false; |
| 25 private int mConnectCalled = 0; |
| 26 |
| 27 public void reset() { |
| 28 mConnectCalled = 0; |
| 29 } |
| 30 |
| 31 public void setBlimpEnabled(boolean enabled) { |
| 32 mEnabled = enabled; |
| 33 } |
| 34 |
| 35 public int connectCalledCount() { |
| 36 return mConnectCalled; |
| 37 } |
| 38 |
| 39 @Override |
| 40 public BlimpContents createBlimpContents() { |
| 41 return null; |
| 42 } |
| 43 |
| 44 @Override |
| 45 public boolean isBlimpSupported() { |
| 46 return true; |
| 47 } |
| 48 |
| 49 @Override |
| 50 public void attachBlimpPreferences(PreferenceFragment fragment) {} |
| 51 |
| 52 @Override |
| 53 public void setDelegate(BlimpClientContextDelegate delegate) {} |
| 54 |
| 55 @Override |
| 56 public boolean isBlimpEnabled() { |
| 57 return mEnabled; |
| 58 } |
| 59 |
| 60 @Override |
| 61 public void connect() { |
| 62 mConnectCalled++; |
| 63 } |
| 64 |
| 65 @Override |
| 66 public BlimpClientContextDelegate getDelegate() { |
| 67 return mDelegate; |
| 68 } |
| 69 |
| 70 @Override |
| 71 public void initSettingsPage(AboutBlimpPreferences preferences) {} |
| 72 } |
OLD | NEW |