| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/tree_node_model.h" | 5 #include "app/tree_node_model.h" |
| 6 #include "base/string16.h" |
| 7 #include "base/utf_string_conversions.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 7 | 9 |
| 8 class TreeNodeModelTest : public testing::Test, public TreeModelObserver { | 10 class TreeNodeModelTest : public testing::Test, public TreeModelObserver { |
| 9 public: | 11 public: |
| 10 TreeNodeModelTest() | 12 TreeNodeModelTest() |
| 11 : added_count_(0), | 13 : added_count_(0), |
| 12 removed_count_(0), | 14 removed_count_(0), |
| 13 changed_count_(0) {} | 15 changed_count_(0) {} |
| 14 | 16 |
| 15 void AssertObserverCount(int added_count, int removed_count, | 17 void AssertObserverCount(int added_count, int removed_count, |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 273 |
| 272 // Makes sure that we are notified when the node is renamed, | 274 // Makes sure that we are notified when the node is renamed, |
| 273 // also makes sure the node is properly renamed. | 275 // also makes sure the node is properly renamed. |
| 274 TEST_F(TreeNodeModelTest, SetTitle) { | 276 TEST_F(TreeNodeModelTest, SetTitle) { |
| 275 TreeNodeWithValue<int>* root = | 277 TreeNodeWithValue<int>* root = |
| 276 new TreeNodeWithValue<int>(L"root", 0); | 278 new TreeNodeWithValue<int>(L"root", 0); |
| 277 TreeNodeModel<TreeNodeWithValue<int> > model(root); | 279 TreeNodeModel<TreeNodeWithValue<int> > model(root); |
| 278 model.AddObserver(this); | 280 model.AddObserver(this); |
| 279 ClearCounts(); | 281 ClearCounts(); |
| 280 | 282 |
| 281 const std::wstring title(L"root2"); | 283 const string16 title(ASCIIToUTF16("root2")); |
| 282 model.SetTitle(root, title); | 284 model.SetTitle(root, UTF16ToWideHack(title)); |
| 283 AssertObserverCount(0, 0, 1); | 285 AssertObserverCount(0, 0, 1); |
| 284 EXPECT_EQ(WideToUTF16(title), root->GetTitleAsString16()); | 286 EXPECT_EQ(title, root->GetTitleAsString16()); |
| 285 } | 287 } |
| OLD | NEW |