summaryrefslogtreecommitdiffstats
path: root/app/tree_node_model_unittest.cc
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-07 05:01:12 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-07 05:01:12 +0000
commitfbcdb02ae14e31b349803e36501468187e5494e1 (patch)
tree11043cf98dc7b9d1435e5047c770d418a38652d7 /app/tree_node_model_unittest.cc
parenta7cab943cd84df541a4f290a431f39942f3934bf (diff)
downloadchromium_src-fbcdb02ae14e31b349803e36501468187e5494e1.zip
chromium_src-fbcdb02ae14e31b349803e36501468187e5494e1.tar.gz
chromium_src-fbcdb02ae14e31b349803e36501468187e5494e1.tar.bz2
Add one more test to TreeNodeModelTest.
This add a SetTitle test, so we can verify if the TreeNodeModelChanged is properly called and the node is properly renamed. BUG=None TEST=out/Debug/app_unittests --gtest_filter=TreeNodeModelTest.SetTitle. Review URL: http://codereview.chromium.org/3015059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55338 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/tree_node_model_unittest.cc')
-rw-r--r--app/tree_node_model_unittest.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/tree_node_model_unittest.cc b/app/tree_node_model_unittest.cc
index 64fbe6f..3b32495 100644
--- a/app/tree_node_model_unittest.cc
+++ b/app/tree_node_model_unittest.cc
@@ -275,3 +275,18 @@ TEST_F(TreeNodeModelTest, GetTotalNodeCount) {
ASSERT_EQ(1, bar1->GetTotalNodeCount());
ASSERT_EQ(2, foo2->GetTotalNodeCount());
}
+
+// Makes sure that we are notified when the node is renamed,
+// also makes sure the node is properly renamed.
+TEST_F(TreeNodeModelTest, SetTitle) {
+ TreeNodeWithValue<int>* root =
+ new TreeNodeWithValue<int>(L"root", 0);
+ TreeNodeModel<TreeNodeWithValue<int> > model(root);
+ model.AddObserver(this);
+ ClearCounts();
+
+ const std::wstring title(L"root2");
+ model.SetTitle(root, title);
+ AssertObserverCount(0, 0, 0, 1);
+ EXPECT_EQ(WideToUTF16(title), root->GetTitleAsString16());
+}