 import Storage
 
 class TestHistory : ProfileTest {
-
-    private func innerAddSite(history: BrowserHistory, url: String, title: String, callback: (success: Bool) -> Void) {
-        // Add an entry
+    private func addSite(history: BrowserHistory, url: String, title: String, s: Bool = true) {
         let site = Site(url: url, title: title)
         let visit = SiteVisit(site: site, date: NSDate.nowMicroseconds())
-        history.addLocalVisit(visit).upon {
-            callback(success: $0.isSuccess)
-        }
-    }
-
-    private func addSite(history: BrowserHistory, url: String, title: String, s: Bool = true) {
-        let expectation = self.expectationWithDescription("Wait for history")
-        innerAddSite(history, url: url, title: title) { success in
-            XCTAssertEqual(success, s, "Site added \(url)")
-            expectation.fulfill()
-        }
+        XCTAssertEqual(s, history.addLocalVisit(visit).value.isSuccess, "Site added: \(url).")
     }
 
     private func innerCheckSites(history: BrowserHistory, callback: (cursor: Cursor<Site>) -> Void) {

            }
            cb()
        default:
            innerClear(history) { success in cb() }
        }
    }


        case 0...1:
            let url = "url \(rand() % 100)"
            let title = "title \(rand() % 100)"
            addSite(history, url: url, title: title)
            cb()
        case 2...3:
            innerCheckSites(history) { cursor in
                for site in cursor {
