-
Notifications
You must be signed in to change notification settings - Fork 885
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4404 from brave/restore-other-bookmarks
Restore other bookmarks
- Loading branch information
Showing
37 changed files
with
849 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
browser/profiles/brave_bookmark_model_loaded_observer_browsertest.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* Copyright (c) 2020 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "brave/common/pref_names.h" | ||
#include "chrome/browser/bookmarks/bookmark_model_factory.h" | ||
#include "chrome/browser/profiles/profile.h" | ||
#include "chrome/browser/ui/browser.h" | ||
#include "chrome/test/base/in_process_browser_test.h" | ||
#include "components/bookmarks/browser/bookmark_model.h" | ||
#include "components/prefs/pref_service.h" | ||
|
||
using BraveBookmarkModelLoadedObserverBrowserTest = InProcessBrowserTest; | ||
|
||
// This test to mainly testing kOtherBookmarksMigrated, granular testing for | ||
// migration is in BookmarkModelTest::BraveMigrateOtherNodeFolder | ||
|
||
namespace { | ||
|
||
void CreateOtherBookmarksFolder(bookmarks::BookmarkModel* model) { | ||
const bookmarks::BookmarkNode* other_node_folder = model->AddFolder( | ||
model->bookmark_bar_node(), model->bookmark_bar_node()->children().size(), | ||
model->other_node()->GetTitledUrlNodeTitle()); | ||
model->AddFolder(other_node_folder, 0, base::ASCIIToUTF16("A")); | ||
} | ||
|
||
} // namespace | ||
|
||
IN_PROC_BROWSER_TEST_F(BraveBookmarkModelLoadedObserverBrowserTest, | ||
PRE_OtherBookmarksMigration) { | ||
Profile* profile = browser()->profile(); | ||
|
||
profile->GetPrefs()->SetBoolean(kOtherBookmarksMigrated, false); | ||
|
||
bookmarks::BookmarkModel* bookmark_model = | ||
BookmarkModelFactory::GetForBrowserContext(profile); | ||
CreateOtherBookmarksFolder(bookmark_model); | ||
} | ||
|
||
IN_PROC_BROWSER_TEST_F(BraveBookmarkModelLoadedObserverBrowserTest, | ||
OtherBookmarksMigration) { | ||
Profile* profile = browser()->profile(); | ||
EXPECT_TRUE(profile->GetPrefs()->GetBoolean(kOtherBookmarksMigrated)); | ||
|
||
bookmarks::BookmarkModel* bookmark_model = | ||
BookmarkModelFactory::GetForBrowserContext(profile); | ||
|
||
ASSERT_EQ(bookmark_model->other_node()->children().size(), 1u); | ||
ASSERT_EQ(bookmark_model->bookmark_bar_node()->children().size(), 0u); | ||
} | ||
|
||
IN_PROC_BROWSER_TEST_F(BraveBookmarkModelLoadedObserverBrowserTest, | ||
PRE_NoOtherBookmarksMigration) { | ||
Profile* profile = browser()->profile(); | ||
|
||
profile->GetPrefs()->SetBoolean(kOtherBookmarksMigrated, true); | ||
|
||
bookmarks::BookmarkModel* bookmark_model = | ||
BookmarkModelFactory::GetForBrowserContext(profile); | ||
|
||
CreateOtherBookmarksFolder(bookmark_model); | ||
} | ||
|
||
IN_PROC_BROWSER_TEST_F(BraveBookmarkModelLoadedObserverBrowserTest, | ||
NoOtherBookmarksMigration) { | ||
Profile* profile = browser()->profile(); | ||
EXPECT_TRUE(profile->GetPrefs()->GetBoolean(kOtherBookmarksMigrated)); | ||
|
||
bookmarks::BookmarkModel* bookmark_model = | ||
BookmarkModelFactory::GetForBrowserContext(profile); | ||
|
||
ASSERT_EQ(bookmark_model->other_node()->children().size(), 0u); | ||
ASSERT_EQ(bookmark_model->bookmark_bar_node()->children().size(), 1u); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 0 additions & 64 deletions
64
chromium_src/chrome/browser/extensions/api/bookmarks/bookmarks_api_unittest.cc
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
chromium_src/chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
chromium_src/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.