| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/profiles/profile_statistics.h" | 5 #include "chrome/browser/profiles/profile_statistics.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
| 29 #include "content/public/test/test_browser_thread_bundle.h" | 29 #include "content/public/test/test_browser_thread_bundle.h" |
| 30 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 std::unique_ptr<KeyedService> BuildBookmarkModelWithoutLoad( | 34 std::unique_ptr<KeyedService> BuildBookmarkModelWithoutLoad( |
| 35 content::BrowserContext* context) { | 35 content::BrowserContext* context) { |
| 36 Profile* profile = Profile::FromBrowserContext(context); | 36 Profile* profile = Profile::FromBrowserContext(context); |
| 37 std::unique_ptr<bookmarks::BookmarkModel> bookmark_model( | 37 std::unique_ptr<bookmarks::BookmarkModel> bookmark_model( |
| 38 new bookmarks::BookmarkModel(base::WrapUnique(new ChromeBookmarkClient( | 38 new bookmarks::BookmarkModel(base::MakeUnique<ChromeBookmarkClient>( |
| 39 profile, ManagedBookmarkServiceFactory::GetForProfile(profile))))); | 39 profile, ManagedBookmarkServiceFactory::GetForProfile(profile)))); |
| 40 return std::move(bookmark_model); | 40 return std::move(bookmark_model); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void LoadBookmarkModel(Profile* profile, | 43 void LoadBookmarkModel(Profile* profile, |
| 44 bookmarks::BookmarkModel* bookmark_model) { | 44 bookmarks::BookmarkModel* bookmark_model) { |
| 45 bookmark_model->Load(profile->GetPrefs(), profile->GetPath(), | 45 bookmark_model->Load(profile->GetPrefs(), profile->GetPath(), |
| 46 profile->GetIOTaskRunner(), | 46 profile->GetIOTaskRunner(), |
| 47 content::BrowserThread::GetTaskRunnerForThread( | 47 content::BrowserThread::GetTaskRunnerForThread( |
| 48 content::BrowserThread::UI)); | 48 content::BrowserThread::UI)); |
| 49 } | 49 } |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 run_loop2.RunUntilIdle(); | 176 run_loop2.RunUntilIdle(); |
| 177 EXPECT_EQ(0, bookmark_stat_helper.GetNumOfTimesCalled()); | 177 EXPECT_EQ(0, bookmark_stat_helper.GetNumOfTimesCalled()); |
| 178 | 178 |
| 179 // Load the bookmark model. When the model is loaded (asynchronously), the | 179 // Load the bookmark model. When the model is loaded (asynchronously), the |
| 180 // observer added by WaitOrCountBookmarks is run. | 180 // observer added by WaitOrCountBookmarks is run. |
| 181 LoadBookmarkModel(profile, bookmark_model); | 181 LoadBookmarkModel(profile, bookmark_model); |
| 182 | 182 |
| 183 run_loop_aggregator_destruction.Run(); | 183 run_loop_aggregator_destruction.Run(); |
| 184 EXPECT_EQ(1, bookmark_stat_helper.GetNumOfTimesCalled()); | 184 EXPECT_EQ(1, bookmark_stat_helper.GetNumOfTimesCalled()); |
| 185 } | 185 } |
| OLD | NEW |