OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser; | 5 package org.chromium.chrome.browser; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.test.InstrumentationTestCase; | 8 import android.test.InstrumentationTestCase; |
9 import android.test.suitebuilder.annotation.SmallTest; | 9 import android.test.suitebuilder.annotation.SmallTest; |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 } | 49 } |
50 | 50 |
51 static class MockSnippetsController extends SnippetsController { | 51 static class MockSnippetsController extends SnippetsController { |
52 private boolean mDidFetchSnippets = false; | 52 private boolean mDidFetchSnippets = false; |
53 | 53 |
54 MockSnippetsController() { | 54 MockSnippetsController() { |
55 super(null); | 55 super(null); |
56 } | 56 } |
57 | 57 |
58 @Override | 58 @Override |
59 public void fetchSnippets(boolean overwrite) { | 59 public void fetchSnippets() { |
60 mDidFetchSnippets = true; | 60 mDidFetchSnippets = true; |
61 } | 61 } |
62 | 62 |
63 protected void checkExpectations(final boolean expectedFetchSnippets) { | 63 protected void checkExpectations(final boolean expectedFetchSnippets) { |
64 ThreadUtils.runOnUiThread(new Runnable() { | 64 ThreadUtils.runOnUiThread(new Runnable() { |
65 @Override | 65 @Override |
66 public void run() { | 66 public void run() { |
67 assertEquals("FetchedSnippets", expectedFetchSnippets, mDidF
etchSnippets); | 67 assertEquals("FetchedSnippets", expectedFetchSnippets, mDidF
etchSnippets); |
68 } | 68 } |
69 }); | 69 }); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 startOnRunTaskAndVerify(SnippetsLauncher.TASK_TAG, false, true); | 118 startOnRunTaskAndVerify(SnippetsLauncher.TASK_TAG, false, true); |
119 } | 119 } |
120 | 120 |
121 @SmallTest | 121 @SmallTest |
122 @Feature({"NTPSnippets"}) | 122 @Feature({"NTPSnippets"}) |
123 public void testNTPSnippetsLaunchBrowserWhenInstanceDoesNotExist() { | 123 public void testNTPSnippetsLaunchBrowserWhenInstanceDoesNotExist() { |
124 deleteSnippetsLauncherInstance(); | 124 deleteSnippetsLauncherInstance(); |
125 startOnRunTaskAndVerify(SnippetsLauncher.TASK_TAG, true, true); | 125 startOnRunTaskAndVerify(SnippetsLauncher.TASK_TAG, true, true); |
126 } | 126 } |
127 } | 127 } |
OLD | NEW |