diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-13 18:54:20 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-13 18:54:20 +0000 |
commit | 992c625bf2d6dfaaa46cf5b45cdcd7de68e7817e (patch) | |
tree | ae6467a99cf17115e04af5bbe358a6219f9c9808 /app/tree_node_iterator_unittest.cc | |
parent | b83fed38db16e462afa3051dcad21318c62b2357 (diff) | |
download | chromium_src-992c625bf2d6dfaaa46cf5b45cdcd7de68e7817e.zip chromium_src-992c625bf2d6dfaaa46cf5b45cdcd7de68e7817e.tar.gz chromium_src-992c625bf2d6dfaaa46cf5b45cdcd7de68e7817e.tar.bz2 |
Move tree-related classes that Linux code depends on from views/ to app/
TEST=If it compiles and unit_tests pass, it's ok. Just moving files around.
http://crbug.com/11066
Review URL: http://codereview.chromium.org/115185
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15982 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/tree_node_iterator_unittest.cc')
-rw-r--r-- | app/tree_node_iterator_unittest.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/app/tree_node_iterator_unittest.cc b/app/tree_node_iterator_unittest.cc new file mode 100644 index 0000000..c20babe --- /dev/null +++ b/app/tree_node_iterator_unittest.cc @@ -0,0 +1,41 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "testing/gtest/include/gtest/gtest.h" + +#include "app/tree_node_iterator.h" +#include "app/tree_node_model.h" + +namespace { + +TEST(TreeNodeIteratorTest, Test) { + TreeNodeWithValue<int> root; + root.Add(0, new TreeNodeWithValue<int>(1)); + root.Add(1, new TreeNodeWithValue<int>(2)); + TreeNodeWithValue<int>* f3 = new TreeNodeWithValue<int>(3); + root.Add(2, f3); + TreeNodeWithValue<int>* f4 = new TreeNodeWithValue<int>(4); + f3->Add(0, f4); + f4->Add(0, new TreeNodeWithValue<int>(5)); + + TreeNodeIterator<TreeNodeWithValue<int> > iterator(&root); + ASSERT_TRUE(iterator.has_next()); + ASSERT_EQ(root.GetChild(0), iterator.Next()); + + ASSERT_TRUE(iterator.has_next()); + ASSERT_EQ(root.GetChild(1), iterator.Next()); + + ASSERT_TRUE(iterator.has_next()); + ASSERT_EQ(root.GetChild(2), iterator.Next()); + + ASSERT_TRUE(iterator.has_next()); + ASSERT_EQ(f4, iterator.Next()); + + ASSERT_TRUE(iterator.has_next()); + ASSERT_EQ(f4->GetChild(0), iterator.Next()); + + ASSERT_FALSE(iterator.has_next()); +} + +} // namespace |