Commit 77afd92b authored by MozLando's avatar MozLando
Browse files

Merge #4811

4811: Issue #4810: browser-state: Child tabs not added next to their parent r=pocmo a=csadilek

This is a follow-up to https://github.com/mozilla-mobile/android-components/pull/4798

.
Co-authored-by: default avatarChristian Sadilek <christian.sadilek@gmail.com>
parents d6ea4775 1cec449a
...@@ -48,6 +48,34 @@ class SessionManagerMigrationTest { ...@@ -48,6 +48,34 @@ class SessionManagerMigrationTest {
assertTrue(tab.content.private) assertTrue(tab.content.private)
} }
@Test
fun `Add session with parent`() {
val store = BrowserStore()
val sessionManager = SessionManager(engine = mock(), store = store)
assertTrue(sessionManager.sessions.isEmpty())
assertTrue(store.state.tabs.isEmpty())
val parent = Session("https://www.mozilla.org")
sessionManager.add(parent)
assertEquals(1, sessionManager.sessions.size)
assertEquals(1, store.state.tabs.size)
sessionManager.add(Session("https://getpocket.com"))
// Make sure child tab was added next to parent
val child = Session("https://www.firefox.com")
sessionManager.add(child, parent = parent)
assertEquals(3, sessionManager.sessions.size)
assertEquals(parent, sessionManager.all.toTypedArray()[0])
assertEquals(child, sessionManager.all.toTypedArray()[1])
assertEquals(3, store.state.tabs.size)
assertEquals("https://www.mozilla.org", store.state.tabs[0].content.url)
assertEquals("https://www.firefox.com", store.state.tabs[1].content.url)
}
@Test @Test
fun `Add custom tab session`() { fun `Add custom tab session`() {
val store = BrowserStore() val store = BrowserStore()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment