1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_TYPED_URLS_HELPER_H_
6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_TYPED_URLS_HELPER_H_
10 #include "chrome/browser/history/history_types.h"
11 #include "content/public/common/page_transition_types.h"
17 namespace typed_urls_helper {
19 // Gets the typed URLs from a specific sync profile.
20 history::URLRows GetTypedUrlsFromClient(int index);
22 // Gets a specific url from a specific sync profile. Returns false if the URL
23 // was not found in the history DB.
24 bool GetUrlFromClient(int index, const GURL& url, history::URLRow* row);
26 // Gets the visits for a URL from a specific sync profile.
27 history::VisitVector GetVisitsFromClient(int index, history::URLID id);
29 // Removes the passed |visits| from a specific sync profile.
30 void RemoveVisitsFromClient(int index, const history::VisitVector& visits);
32 // Adds a URL to the history DB for a specific sync profile (just registers a
33 // new visit if the URL already exists) using a TYPED PageTransition.
34 void AddUrlToHistory(int index, const GURL& url);
36 // Adds a URL to the history DB for a specific sync profile (just registers a
37 // new visit if the URL already exists), using the passed PageTransition.
38 void AddUrlToHistoryWithTransition(int index,
40 content::PageTransition transition,
41 history::VisitSource source);
43 // Adds a URL to the history DB for a specific sync profile (just registers a
44 // new visit if the URL already exists), using the passed PageTransition and
46 void AddUrlToHistoryWithTimestamp(int index,
48 content::PageTransition transition,
49 history::VisitSource source,
50 const base::Time& timestamp);
52 // Deletes a URL from the history DB for a specific sync profile.
53 void DeleteUrlFromHistory(int index, const GURL& url);
55 // Deletes a list of URLs from the history DB for a specific sync
57 void DeleteUrlsFromHistory(int index, const std::vector<GURL>& urls);
59 // Returns true if all clients match the verifier profile.
60 void AssertAllProfilesHaveSameURLsAsVerifier();
62 // Checks that the two vectors contain the same set of URLRows (possibly in
63 // a different order).
64 void AssertURLRowVectorsAreEqual(const history::URLRows& left,
65 const history::URLRows& right);
67 // Checks that the passed URLRows are equivalent.
68 void AssertURLRowsAreEqual(const history::URLRow& left,
69 const history::URLRow& right);
71 // Returns true if two sets of visits are equivalent.
72 bool AreVisitsEqual(const history::VisitVector& visit1,
73 const history::VisitVector& visit2);
75 // Returns true if there are no duplicate visit times.
76 bool AreVisitsUnique(const history::VisitVector& visits);
78 // Returns a unique timestamp to use when generating page visits
79 // (HistoryService does not like having identical timestamps and will modify
80 // the timestamps behind the scenes if it encounters them, which leads to
81 // spurious test failures when the resulting timestamps aren't what we
83 base::Time GetTimestamp();
85 } // namespace typed_urls_helper
87 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_TYPED_URLS_HELPER_H_