         delegate.verify("Not all delegate methods were called")
     }
 
+    func testRemoveTabSelectedTabShouldChangeIndex() {
+        let profile = TabManagerMockProfile()
+        let manager = TabManager(prefs: profile.prefs, imageStore: nil)
+
+        let tab1 = manager.addTab()
+        manager.addTab()
+        let tab3 = manager.addTab()
+
+        manager.selectTab(tab3)
+        let beforeRemoveTabIndex = manager.selectedIndex
+        manager.removeTab(tab1)
+        XCTAssertNotEqual(manager.selectedIndex, beforeRemoveTabIndex)
+        XCTAssertEqual(manager.selectedTab, tab3)
+        XCTAssertEqual(manager.tabs[manager.selectedIndex], tab3)
+    }
+
+    func testRemoveTabRemovingLastNormalTabShouldNotSwitchToPrivateTab() {
+        let profile = TabManagerMockProfile()
+        let manager = TabManager(prefs: profile.prefs, imageStore: nil)
+
+        let tab0 = manager.addTab()
+        let tab1 = manager.addTab(isPrivate: true)
+
+        manager.selectTab(tab0)
+        // select private tab, so we are in privateMode
+        manager.selectTab(tab1, previous: tab0)
+        // if we are able to remove normal tab this means we are no longer in private mode
+        manager.removeTab(tab0)
+        // manager should creat new tab and select it
+        XCTAssertNotEqual(manager.selectedTab, tab1)
+        XCTAssertNotEqual(manager.selectedIndex, manager.tabs.index(of: tab1))
+    }
+
+    func testRemoveAllShouldRemoveAllTabs() {
+        let profile = TabManagerMockProfile()
+        let manager = TabManager(prefs: profile.prefs, imageStore: nil)
+
+        let tab0 = manager.addTab()
+        let tab1 = manager.addTab()
+
+        manager.removeAll()
+        XCTAssert(nil == manager.tabs.index(of: tab0))
+        XCTAssert(nil == manager.tabs.index(of: tab1))
+    }
+
     // Private tabs and regular tabs are in the same tabs array.
     // Make sure that when a private tab is added inbetween regular tabs it isnt accidently selected when removing a regular tab
     func testTabsIndex() {

        delegate.expect([willAdd, didAdd])
        manager.addTab()
        delegate.verify("Not all delegate methods were called")
    }

    func testDidDeleteLastTab() {

        XCTAssertEqual(stateDelegate.numberOfTabsStored, 0, "Expected state delegate to have been called with 3 tabs, but called with \(stateDelegate.numberOfTabsStored)")
    }

    func testAddTabShouldAddOneNormalTab() {
        let profile = TabManagerMockProfile()
        let manager = TabManager(prefs: profile.prefs, imageStore: nil)
        let delegate = MockTabManagerDelegate()
