Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(965)

Side by Side Diff: chrome/test/live_sync/bookmark_model_verifier.h

Issue 159728: Add browser/sync to the repository. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/chrome.gyp ('k') | chrome/test/live_sync/bookmark_model_verifier.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2006-2009 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.
4
5 #ifdef CHROME_PERSONALIZATION
6
7 #ifndef CHROME_TEST_LIVE_SYNC_BOOKMARK_MODEL_VERIFIER_H_
8 #define CHROME_TEST_LIVE_SYNC_BOOKMARK_MODEL_VERIFIER_H_
9
10 #include <string>
11 #include "chrome/browser/profile.h"
12 #include "googleurl/src/gurl.h"
13
14 class BookmarkModel;
15 class BookmarkNode;
16
17 // A tool to perform bookmark model operations on a model and have
18 // the changes echoed in a "verifier" model that can be used as an expected
19 // hierarchy to compare against.
20 // Note when we refer to the "same" nodes in |model| and |verifier| parameters,
21 // we mean same the canonical bookmark entity, because |verifier| is expected
22 // to be a replica of |model|.
23 class BookmarkModelVerifier {
24 public:
25 ~BookmarkModelVerifier() { }
26
27 // Creates a BookmarkModelVerifier and waits until the model has loaded.
28 // Caller takes ownership.
29 static BookmarkModelVerifier* Create();
30
31 // Adds the same folder to |model| and |verifier|.
32 // See BookmarkModel::AddGroup for details.
33 const BookmarkNode* AddGroup(BookmarkModel* model,
34 const BookmarkNode* parent,
35 int index,
36 const string16& title);
37
38 // Adds the same bookmark to |model| and |verifier|.
39 // See BookmarkModel::AddURL for details.
40 const BookmarkNode* AddURL(BookmarkModel* model,
41 const BookmarkNode* parent,
42 int index,
43 const string16& title,
44 const GURL& url);
45
46 // Sets the title of the same node in |model| and |verifier|.
47 // See BookmarkModel::SetTitle for details.
48 void SetTitle(BookmarkModel* model, const BookmarkNode* node,
49 const string16& title);
50
51 // Moves the same node to the same position in both |model| and |verifier|.
52 // See BookmarkModel::Move for details.
53 void Move(BookmarkModel* model,
54 const BookmarkNode* node,
55 const BookmarkNode* new_parent,
56 int index);
57
58 // Removes the same node in |model| and |verifier|.
59 // See BookmarkModel::Remove for details.
60 void Remove(BookmarkModel* model, const BookmarkNode* parent, int index);
61
62 // Sorts children of the same parent node in |model| and |verifier|.
63 // See BookmarkModel::SortChildren for details.
64 void SortChildren(BookmarkModel* model, const BookmarkNode* parent);
65
66 void SetURL(BookmarkModel* model,
67 const BookmarkNode* node,
68 const GURL& new_url);
69
70 // Asserts that the verifier model and |actual| are equivalent.
71 void ExpectMatch(BookmarkModel* actual);
72
73 // Asserts that the two hierarchies are equivalent in terms of the data model.
74 // (e.g some peripheral fields like creation times are allowed to mismatch).
75 static void ExpectModelsMatch(BookmarkModel* expected, BookmarkModel* actual);
76
77 private:
78 BookmarkModelVerifier();
79 void FindNodeInVerifier(BookmarkModel* foreign_model,
80 const BookmarkNode* foreign_node,
81 const BookmarkNode** result);
82
83 // Does a deep comparison of BookmarkNode fields between the two parameters,
84 // and asserts equality.
85 static void ExpectBookmarkInfoMatch(const BookmarkNode* expected,
86 const BookmarkNode* actual);
87
88 scoped_ptr<Profile> verifier_profile_;
89 BookmarkModel* verifier_;
90 DISALLOW_COPY_AND_ASSIGN(BookmarkModelVerifier);
91 };
92
93 #endif // CHROME_TEST_LIVE_SYNC_BOOKMARK_MODEL_VERIFIER_H_
94
95 #endif // CHROME_PERSONALIZATION
OLDNEW
« no previous file with comments | « chrome/chrome.gyp ('k') | chrome/test/live_sync/bookmark_model_verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698