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" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // Base class for bookmark editor tests. Creates a BookmarkModel and populates | 28 // Base class for bookmark editor tests. Creates a BookmarkModel and populates |
29 // it with test data. | 29 // it with test data. |
30 class BookmarkEditorViewTest : public testing::Test { | 30 class BookmarkEditorViewTest : public testing::Test { |
31 public: | 31 public: |
32 BookmarkEditorViewTest() : model_(nullptr) {} | 32 BookmarkEditorViewTest() : model_(nullptr) {} |
33 | 33 |
34 void SetUp() override { | 34 void SetUp() override { |
35 profile_.reset(new TestingProfile()); | 35 profile_.reset(new TestingProfile()); |
36 profile_->CreateBookmarkModel(true); | 36 profile_->CreateBookmarkModel(true); |
37 | 37 |
38 model_ = BookmarkModelFactory::GetForProfile(profile_.get()); | 38 model_ = BookmarkModelFactory::GetForBrowserContext(profile_.get()); |
39 bookmarks::test::WaitForBookmarkModelToLoad(model_); | 39 bookmarks::test::WaitForBookmarkModelToLoad(model_); |
40 | 40 |
41 AddTestData(); | 41 AddTestData(); |
42 } | 42 } |
43 | 43 |
44 protected: | 44 protected: |
45 std::string base_path() const { return "file:///c:/tmp/"; } | 45 std::string base_path() const { return "file:///c:/tmp/"; } |
46 | 46 |
47 const BookmarkNode* GetNode(const std::string& name) { | 47 const BookmarkNode* GetNode(const std::string& name) { |
48 return model_->GetMostRecentlyAddedUserNodeForURL(GURL(base_path() + name)); | 48 return model_->GetMostRecentlyAddedUserNodeForURL(GURL(base_path() + name)); |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 ASSERT_TRUE(tree_view()->editor() != NULL); | 408 ASSERT_TRUE(tree_view()->editor() != NULL); |
409 tree_view()->editor()->SetText(ASCIIToUTF16("modified")); | 409 tree_view()->editor()->SetText(ASCIIToUTF16("modified")); |
410 ApplyEdits(); | 410 ApplyEdits(); |
411 | 411 |
412 // Verify the new folder was added and title set appropriately. | 412 // Verify the new folder was added and title set appropriately. |
413 ASSERT_EQ(1, parent->child_count()); | 413 ASSERT_EQ(1, parent->child_count()); |
414 const BookmarkNode* new_folder = parent->GetChild(0); | 414 const BookmarkNode* new_folder = parent->GetChild(0); |
415 ASSERT_TRUE(new_folder->is_folder()); | 415 ASSERT_TRUE(new_folder->is_folder()); |
416 EXPECT_EQ("modified", base::UTF16ToASCII(new_folder->GetTitle())); | 416 EXPECT_EQ("modified", base::UTF16ToASCII(new_folder->GetTitle())); |
417 } | 417 } |
OLD | NEW |