OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/base_paths.h" | 8 #include "base/base_paths.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 | 82 |
83 private: | 83 private: |
84 const BookmarkNode* node1_; | 84 const BookmarkNode* node1_; |
85 const BookmarkNode* node2_; | 85 const BookmarkNode* node2_; |
86 int index1_; | 86 int index1_; |
87 int index2_; | 87 int index2_; |
88 }; | 88 }; |
89 | 89 |
90 BookmarkModelTest() | 90 BookmarkModelTest() |
91 : model_(NULL), | 91 : model_(NULL) { |
92 original_command_line_(*CommandLine::ForCurrentProcess()) { | |
93 model_.AddObserver(this); | 92 model_.AddObserver(this); |
94 ClearCounts(); | 93 ClearCounts(); |
95 } | 94 } |
96 | 95 |
97 virtual void TearDown() OVERRIDE { | |
98 *CommandLine::ForCurrentProcess() = original_command_line_; | |
99 } | |
100 | |
101 void Loaded(BookmarkModel* model, bool ids_reassigned) OVERRIDE { | 96 void Loaded(BookmarkModel* model, bool ids_reassigned) OVERRIDE { |
102 // We never load from the db, so that this should never get invoked. | 97 // We never load from the db, so that this should never get invoked. |
103 NOTREACHED(); | 98 NOTREACHED(); |
104 } | 99 } |
105 | 100 |
106 virtual void BookmarkNodeMoved(BookmarkModel* model, | 101 virtual void BookmarkNodeMoved(BookmarkModel* model, |
107 const BookmarkNode* old_parent, | 102 const BookmarkNode* old_parent, |
108 int old_index, | 103 int old_index, |
109 const BookmarkNode* new_parent, | 104 const BookmarkNode* new_parent, |
110 int new_index) OVERRIDE { | 105 int new_index) OVERRIDE { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 EXPECT_EQ(removed_count_, removed_count); | 155 EXPECT_EQ(removed_count_, removed_count); |
161 EXPECT_EQ(changed_count_, changed_count); | 156 EXPECT_EQ(changed_count_, changed_count); |
162 EXPECT_EQ(reordered_count_, reordered_count); | 157 EXPECT_EQ(reordered_count_, reordered_count); |
163 } | 158 } |
164 | 159 |
165 protected: | 160 protected: |
166 BookmarkModel model_; | 161 BookmarkModel model_; |
167 ObserverDetails observer_details_; | 162 ObserverDetails observer_details_; |
168 | 163 |
169 private: | 164 private: |
170 CommandLine original_command_line_; | |
171 | |
172 int added_count_; | 165 int added_count_; |
173 int moved_count_; | 166 int moved_count_; |
174 int removed_count_; | 167 int removed_count_; |
175 int changed_count_; | 168 int changed_count_; |
176 int reordered_count_; | 169 int reordered_count_; |
177 | 170 |
178 DISALLOW_COPY_AND_ASSIGN(BookmarkModelTest); | 171 DISALLOW_COPY_AND_ASSIGN(BookmarkModelTest); |
179 }; | 172 }; |
180 | 173 |
181 TEST_F(BookmarkModelTest, InitialState) { | 174 TEST_F(BookmarkModelTest, InitialState) { |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 TEST_F(BookmarkModelTest, SyncNodeVisibileWithChildren) { | 1030 TEST_F(BookmarkModelTest, SyncNodeVisibileWithChildren) { |
1038 const BookmarkNode* root = model_.synced_node(); | 1031 const BookmarkNode* root = model_.synced_node(); |
1039 const string16 title(ASCIIToUTF16("foo")); | 1032 const string16 title(ASCIIToUTF16("foo")); |
1040 const GURL url("http://foo.com"); | 1033 const GURL url("http://foo.com"); |
1041 | 1034 |
1042 model_.AddURL(root, 0, title, url); | 1035 model_.AddURL(root, 0, title, url); |
1043 EXPECT_TRUE(model_.synced_node()->IsVisible()); | 1036 EXPECT_TRUE(model_.synced_node()->IsVisible()); |
1044 } | 1037 } |
1045 | 1038 |
1046 } // namespace | 1039 } // namespace |
OLD | NEW |