OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.graphics.Bitmap; | 7 import android.graphics.Bitmap; |
8 import android.test.suitebuilder.annotation.MediumTest; | 8 import android.test.suitebuilder.annotation.MediumTest; |
9 import android.test.suitebuilder.annotation.SmallTest; | 9 import android.test.suitebuilder.annotation.SmallTest; |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 private static class TestNavigationHistory extends NavigationHistory { | 43 private static class TestNavigationHistory extends NavigationHistory { |
44 @Override | 44 @Override |
45 public void addEntry(NavigationEntry entry) { | 45 public void addEntry(NavigationEntry entry) { |
46 super.addEntry(entry); | 46 super.addEntry(entry); |
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 // Exists solely to expose protected methods to this test. | 50 // Exists solely to expose protected methods to this test. |
51 private static class TestNavigationEntry extends NavigationEntry { | 51 private static class TestNavigationEntry extends NavigationEntry { |
52 public TestNavigationEntry(int index, String url, String virtualUrl, Str
ing originalUrl, | 52 public TestNavigationEntry(int index, String url, String virtualUrl, Str
ing originalUrl, |
53 String title, Bitmap favicon) { | 53 String title, Bitmap favicon, int transition) { |
54 super(index, url, virtualUrl, originalUrl, title, favicon); | 54 super(index, url, virtualUrl, originalUrl, title, favicon, transitio
n); |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 private static class TestNavigationController implements NavigationControlle
r { | 58 private static class TestNavigationController implements NavigationControlle
r { |
59 private final TestNavigationHistory mHistory; | 59 private final TestNavigationHistory mHistory; |
60 private int mNavigatedIndex = INVALID_NAVIGATION_INDEX; | 60 private int mNavigatedIndex = INVALID_NAVIGATION_INDEX; |
61 | 61 |
62 public TestNavigationController() { | 62 public TestNavigationController() { |
63 mHistory = new TestNavigationHistory(); | 63 mHistory = new TestNavigationHistory(); |
64 mHistory.addEntry(new TestNavigationEntry( | 64 mHistory.addEntry(new TestNavigationEntry( |
65 1, "about:blank", null, null, "About Blank", null)); | 65 1, "about:blank", null, null, "About Blank", null, 0)); |
66 mHistory.addEntry(new TestNavigationEntry( | 66 mHistory.addEntry(new TestNavigationEntry( |
67 5, UrlUtils.encodeHtmlDataUri("<html>1</html>"), null, null,
null, null)); | 67 5, UrlUtils.encodeHtmlDataUri("<html>1</html>"), null, null,
null, null, 0)); |
68 } | 68 } |
69 | 69 |
70 @Override | 70 @Override |
71 public boolean canGoBack() { | 71 public boolean canGoBack() { |
72 return false; | 72 return false; |
73 } | 73 } |
74 | 74 |
75 @Override | 75 @Override |
76 public boolean canGoForward() { | 76 public boolean canGoForward() { |
77 return false; | 77 return false; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 popup.performItemClick(1); | 252 popup.performItemClick(1); |
253 } | 253 } |
254 }); | 254 }); |
255 | 255 |
256 assertFalse("Popup did not hide as expected.", popup.isShowing()); | 256 assertFalse("Popup did not hide as expected.", popup.isShowing()); |
257 assertEquals("Popup attempted to navigate to the wrong index", 5, | 257 assertEquals("Popup attempted to navigate to the wrong index", 5, |
258 controller.mNavigatedIndex); | 258 controller.mNavigatedIndex); |
259 } | 259 } |
260 | 260 |
261 } | 261 } |
OLD | NEW |