| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/scoped_nsobject.h" | 7 #include "base/scoped_nsobject.h" |
| 8 #import "chrome/browser/cocoa/bookmark_name_folder_controller.h" | 8 #import "chrome/browser/cocoa/bookmark_name_folder_controller.h" |
| 9 #include "chrome/browser/cocoa/browser_test_helper.h" | 9 #include "chrome/browser/cocoa/browser_test_helper.h" |
| 10 #import "chrome/browser/cocoa/cocoa_test_helper.h" | 10 #import "chrome/browser/cocoa/cocoa_test_helper.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #import "testing/gtest_mac.h" |
| 12 #include "testing/platform_test.h" | 13 #include "testing/platform_test.h" |
| 13 | 14 |
| 14 class BookmarkNameFolderControllerTest : public CocoaTest { | 15 class BookmarkNameFolderControllerTest : public CocoaTest { |
| 15 public: | 16 public: |
| 16 BrowserTestHelper helper_; | 17 BrowserTestHelper helper_; |
| 17 }; | 18 }; |
| 18 | 19 |
| 19 | 20 |
| 20 // Simple add of a node (at the end). | 21 // Simple add of a node (at the end). |
| 21 TEST_F(BookmarkNameFolderControllerTest, AddNew) { | 22 TEST_F(BookmarkNameFolderControllerTest, AddNew) { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 127 |
| 127 // Rename the folder by creating a controller that originates from | 128 // Rename the folder by creating a controller that originates from |
| 128 // the node. | 129 // the node. |
| 129 scoped_nsobject<BookmarkNameFolderController> | 130 scoped_nsobject<BookmarkNameFolderController> |
| 130 controller([[BookmarkNameFolderController alloc] | 131 controller([[BookmarkNameFolderController alloc] |
| 131 initWithParentWindow:test_window() | 132 initWithParentWindow:test_window() |
| 132 profile:helper_.profile() | 133 profile:helper_.profile() |
| 133 node:folder]); | 134 node:folder]); |
| 134 [controller window]; // force nib load | 135 [controller window]; // force nib load |
| 135 | 136 |
| 136 EXPECT_TRUE([[controller folderName] isEqual:@"group"]); | 137 EXPECT_NSEQ(@"group", [controller folderName]); |
| 137 [controller setFolderName:@"Zobo"]; | 138 [controller setFolderName:@"Zobo"]; |
| 138 [controller ok:nil]; | 139 [controller ok:nil]; |
| 139 EXPECT_EQ(1, parent->GetChildCount()); | 140 EXPECT_EQ(1, parent->GetChildCount()); |
| 140 EXPECT_TRUE(parent->GetChild(0)->is_folder()); | 141 EXPECT_TRUE(parent->GetChild(0)->is_folder()); |
| 141 EXPECT_EQ(L"Zobo", parent->GetChild(0)->GetTitle()); | 142 EXPECT_EQ(L"Zobo", parent->GetChild(0)->GetTitle()); |
| 142 } | 143 } |
| 143 | 144 |
| 144 TEST_F(BookmarkNameFolderControllerTest, EditAndConfirmOKButton) { | 145 TEST_F(BookmarkNameFolderControllerTest, EditAndConfirmOKButton) { |
| 145 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); | 146 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); |
| 146 const BookmarkNode* parent = model->GetBookmarkBarNode(); | 147 const BookmarkNode* parent = model->GetBookmarkBarNode(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 159 | 160 |
| 160 [controller setFolderName:@"Bozo"]; | 161 [controller setFolderName:@"Bozo"]; |
| 161 EXPECT_TRUE([[controller okButton] isEnabled]); | 162 EXPECT_TRUE([[controller okButton] isEnabled]); |
| 162 [controller setFolderName:@" "]; | 163 [controller setFolderName:@" "]; |
| 163 EXPECT_TRUE([[controller okButton] isEnabled]); | 164 EXPECT_TRUE([[controller okButton] isEnabled]); |
| 164 | 165 |
| 165 [controller setFolderName:@""]; | 166 [controller setFolderName:@""]; |
| 166 EXPECT_TRUE([[controller okButton] isEnabled]); | 167 EXPECT_TRUE([[controller okButton] isEnabled]); |
| 167 } | 168 } |
| 168 | 169 |
| OLD | NEW |