OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/strings/string16.h" | 7 #include "base/strings/string16.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 [controller_ ok:nil]; | 89 [controller_ ok:nil]; |
90 ASSERT_EQ(default_parent_->child_count(), 1); | 90 ASSERT_EQ(default_parent_->child_count(), 1); |
91 const BookmarkNode* child = default_parent_->GetChild(0); | 91 const BookmarkNode* child = default_parent_->GetChild(0); |
92 EXPECT_TRUE(child->url().is_valid()); | 92 EXPECT_TRUE(child->url().is_valid()); |
93 } | 93 } |
94 | 94 |
95 TEST_F(BookmarkEditorControllerTest, NodeDeleted) { | 95 TEST_F(BookmarkEditorControllerTest, NodeDeleted) { |
96 // Delete the bookmark being edited and verify the sheet cancels itself: | 96 // Delete the bookmark being edited and verify the sheet cancels itself: |
97 ASSERT_TRUE([test_window() attachedSheet]); | 97 ASSERT_TRUE([test_window() attachedSheet]); |
98 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile()); | 98 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile()); |
99 model->Remove(default_parent_, 0); | 99 model->Remove(default_parent_->GetChild(0)); |
100 ASSERT_FALSE([test_window() attachedSheet]); | 100 ASSERT_FALSE([test_window() attachedSheet]); |
101 } | 101 } |
102 | 102 |
103 TEST_F(BookmarkEditorControllerTest, EditAndConfirmOKButton) { | 103 TEST_F(BookmarkEditorControllerTest, EditAndConfirmOKButton) { |
104 // Confirm OK button enabled/disabled as appropriate: | 104 // Confirm OK button enabled/disabled as appropriate: |
105 // First test the URL. | 105 // First test the URL. |
106 EXPECT_TRUE([controller_ okButtonEnabled]); | 106 EXPECT_TRUE([controller_ okButtonEnabled]); |
107 [controller_ setDisplayURL:@""]; | 107 [controller_ setDisplayURL:@""]; |
108 EXPECT_FALSE([controller_ okButtonEnabled]); | 108 EXPECT_FALSE([controller_ okButtonEnabled]); |
109 [controller_ setDisplayURL:@"http://www.cnn.com"]; | 109 [controller_ setDisplayURL:@"http://www.cnn.com"]; |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 | 474 |
475 TEST_F(BookmarkEditorControllerTreeNoNodeTest, NewBookmarkNoNode) { | 475 TEST_F(BookmarkEditorControllerTreeNoNodeTest, NewBookmarkNoNode) { |
476 [controller_ setDisplayName:@"NEW BOOKMARK"]; | 476 [controller_ setDisplayName:@"NEW BOOKMARK"]; |
477 [controller_ setDisplayURL:@"http://NEWURL.com"]; | 477 [controller_ setDisplayURL:@"http://NEWURL.com"]; |
478 [controller_ ok:nil]; | 478 [controller_ ok:nil]; |
479 const BookmarkNode* new_node = folder_bb_->GetChild(5); | 479 const BookmarkNode* new_node = folder_bb_->GetChild(5); |
480 ASSERT_EQ(0, new_node->child_count()); | 480 ASSERT_EQ(0, new_node->child_count()); |
481 EXPECT_EQ(new_node->GetTitle(), ASCIIToUTF16("NEW BOOKMARK")); | 481 EXPECT_EQ(new_node->GetTitle(), ASCIIToUTF16("NEW BOOKMARK")); |
482 EXPECT_EQ(new_node->url(), GURL("http://NEWURL.com")); | 482 EXPECT_EQ(new_node->url(), GURL("http://NEWURL.com")); |
483 } | 483 } |
OLD | NEW |