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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
15 #include "components/bookmarks/browser/bookmark_model.h" | 15 #include "components/bookmarks/browser/bookmark_model.h" |
16 #include "components/bookmarks/test/bookmark_test_helpers.h" | 16 #include "components/bookmarks/test/bookmark_test_helpers.h" |
17 #include "content/public/test/test_browser_thread.h" | 17 #include "content/public/test/test_browser_thread.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "ui/views/controls/textfield/textfield.h" | 19 #include "ui/views/controls/textfield/textfield.h" |
20 #include "ui/views/controls/tree/tree_view.h" | 20 #include "ui/views/controls/tree/tree_view.h" |
21 | 21 |
22 using base::ASCIIToUTF16; | 22 using base::ASCIIToUTF16; |
23 using base::UTF8ToUTF16; | 23 using base::UTF8ToUTF16; |
24 using base::Time; | 24 using base::Time; |
25 using base::TimeDelta; | 25 using base::TimeDelta; |
26 using bookmarks::BookmarkModel; | 26 using bookmarks::BookmarkModel; |
| 27 using bookmarks::BookmarkNode; |
27 using content::BrowserThread; | 28 using content::BrowserThread; |
28 | 29 |
29 // Base class for bookmark editor tests. Creates a BookmarkModel and populates | 30 // Base class for bookmark editor tests. Creates a BookmarkModel and populates |
30 // it with test data. | 31 // it with test data. |
31 class BookmarkEditorViewTest : public testing::Test { | 32 class BookmarkEditorViewTest : public testing::Test { |
32 public: | 33 public: |
33 BookmarkEditorViewTest() | 34 BookmarkEditorViewTest() |
34 : ui_thread_(BrowserThread::UI, &message_loop_), | 35 : ui_thread_(BrowserThread::UI, &message_loop_), |
35 file_thread_(BrowserThread::FILE, &message_loop_), | 36 file_thread_(BrowserThread::FILE, &message_loop_), |
36 model_(NULL) { | 37 model_(NULL) { |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 ASSERT_TRUE(tree_view()->editor() != NULL); | 428 ASSERT_TRUE(tree_view()->editor() != NULL); |
428 tree_view()->editor()->SetText(ASCIIToUTF16("modified")); | 429 tree_view()->editor()->SetText(ASCIIToUTF16("modified")); |
429 ApplyEdits(); | 430 ApplyEdits(); |
430 | 431 |
431 // Verify the new folder was added and title set appropriately. | 432 // Verify the new folder was added and title set appropriately. |
432 ASSERT_EQ(1, parent->child_count()); | 433 ASSERT_EQ(1, parent->child_count()); |
433 const BookmarkNode* new_folder = parent->GetChild(0); | 434 const BookmarkNode* new_folder = parent->GetChild(0); |
434 ASSERT_TRUE(new_folder->is_folder()); | 435 ASSERT_TRUE(new_folder->is_folder()); |
435 EXPECT_EQ("modified", base::UTF16ToASCII(new_folder->GetTitle())); | 436 EXPECT_EQ("modified", base::UTF16ToASCII(new_folder->GetTitle())); |
436 } | 437 } |
OLD | NEW |