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 #include "chrome/browser/ui/views/bookmarks/bookmark_editor_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_editor_view.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
14 #include "components/bookmarks/browser/bookmark_model.h" | 14 #include "components/bookmarks/browser/bookmark_model.h" |
15 #include "components/bookmarks/test/bookmark_test_helpers.h" | 15 #include "components/bookmarks/test/bookmark_test_helpers.h" |
16 #include "content/public/test/test_browser_thread_bundle.h" | 16 #include "content/public/test/test_browser_thread_bundle.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "ui/views/controls/textfield/textfield.h" | 18 #include "ui/views/controls/textfield/textfield.h" |
19 #include "ui/views/controls/tree/tree_view.h" | 19 #include "ui/views/controls/tree/tree_view.h" |
| 20 #include "ui/views/test/test_views_delegate.h" |
20 | 21 |
21 using base::ASCIIToUTF16; | 22 using base::ASCIIToUTF16; |
22 using base::UTF8ToUTF16; | 23 using base::UTF8ToUTF16; |
23 using base::Time; | 24 using base::Time; |
24 using base::TimeDelta; | 25 using base::TimeDelta; |
25 using bookmarks::BookmarkModel; | 26 using bookmarks::BookmarkModel; |
26 using bookmarks::BookmarkNode; | 27 using bookmarks::BookmarkNode; |
27 | 28 |
28 // Base class for bookmark editor tests. Creates a BookmarkModel and populates | 29 // Base class for bookmark editor tests. Creates a BookmarkModel and populates |
29 // it with test data. | 30 // it with test data. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 106 |
106 void ExpandAndSelect() { | 107 void ExpandAndSelect() { |
107 editor_->ExpandAndSelect(); | 108 editor_->ExpandAndSelect(); |
108 } | 109 } |
109 | 110 |
110 views::TreeView* tree_view() { return editor_->tree_view_; } | 111 views::TreeView* tree_view() { return editor_->tree_view_; } |
111 | 112 |
112 content::TestBrowserThreadBundle thread_bundle_; | 113 content::TestBrowserThreadBundle thread_bundle_; |
113 | 114 |
114 BookmarkModel* model_; | 115 BookmarkModel* model_; |
| 116 views::TestViewsDelegate views_delegate_; |
115 std::unique_ptr<TestingProfile> profile_; | 117 std::unique_ptr<TestingProfile> profile_; |
116 | 118 |
117 private: | 119 private: |
118 // Creates the following structure: | 120 // Creates the following structure: |
119 // bookmark bar node | 121 // bookmark bar node |
120 // a | 122 // a |
121 // F1 | 123 // F1 |
122 // f1a | 124 // f1a |
123 // F11 | 125 // F11 |
124 // f11a | 126 // f11a |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 ASSERT_TRUE(tree_view()->editor() != NULL); | 445 ASSERT_TRUE(tree_view()->editor() != NULL); |
444 tree_view()->editor()->SetText(ASCIIToUTF16("modified")); | 446 tree_view()->editor()->SetText(ASCIIToUTF16("modified")); |
445 ApplyEdits(); | 447 ApplyEdits(); |
446 | 448 |
447 // Verify the new folder was added and title set appropriately. | 449 // Verify the new folder was added and title set appropriately. |
448 ASSERT_EQ(1, parent->child_count()); | 450 ASSERT_EQ(1, parent->child_count()); |
449 const BookmarkNode* new_folder = parent->GetChild(0); | 451 const BookmarkNode* new_folder = parent->GetChild(0); |
450 ASSERT_TRUE(new_folder->is_folder()); | 452 ASSERT_TRUE(new_folder->is_folder()); |
451 EXPECT_EQ("modified", base::UTF16ToASCII(new_folder->GetTitle())); | 453 EXPECT_EQ("modified", base::UTF16ToASCII(new_folder->GetTitle())); |
452 } | 454 } |
OLD | NEW |