Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(552)

Side by Side Diff: chrome/browser/extensions/api/top_sites/top_sites_apitest.cc

Issue 2083363002: Remove calls to deprecated MessageLoop methods in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/run_loop.h"
7 #include "base/values.h" 8 #include "base/values.h"
8 #include "build/build_config.h" 9 #include "build/build_config.h"
9 #include "chrome/browser/extensions/api/top_sites/top_sites_api.h" 10 #include "chrome/browser/extensions/api/top_sites/top_sites_api.h"
10 #include "chrome/browser/extensions/extension_function_test_utils.h" 11 #include "chrome/browser/extensions/extension_function_test_utils.h"
11 #include "chrome/browser/history/top_sites_factory.h" 12 #include "chrome/browser/history/top_sites_factory.h"
12 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
14 #include "chrome/test/base/in_process_browser_test.h" 15 #include "chrome/test/base/in_process_browser_test.h"
15 #include "components/history/core/browser/top_sites.h" 16 #include "components/history/core/browser/top_sites.h"
16 17
(...skipping 18 matching lines...) Expand all
35 top_sites->GetPrepopulatedPages().size(); 36 top_sites->GetPrepopulatedPages().size();
36 37
37 // This may return async or sync. If sync, top_sites_inited_ will be true 38 // This may return async or sync. If sync, top_sites_inited_ will be true
38 // before we get to the conditional below. Otherwise, we'll run a nested 39 // before we get to the conditional below. Otherwise, we'll run a nested
39 // message loop until the async callback. 40 // message loop until the async callback.
40 top_sites->GetMostVisitedURLs( 41 top_sites->GetMostVisitedURLs(
41 base::Bind(&TopSitesExtensionTest::OnTopSitesAvailable, this), false); 42 base::Bind(&TopSitesExtensionTest::OnTopSitesAvailable, this), false);
42 43
43 if (!top_sites_inited_) { 44 if (!top_sites_inited_) {
44 waiting_ = true; 45 waiting_ = true;
45 base::MessageLoop::current()->Run(); 46 base::RunLoop().Run();
46 } 47 }
47 48
48 // By this point, we know topsites has loaded. We can run the tests now. 49 // By this point, we know topsites has loaded. We can run the tests now.
49 } 50 }
50 51
51 size_t top_sites_prepopulated_pages_size() const { 52 size_t top_sites_prepopulated_pages_size() const {
52 return top_sites_prepopulated_pages_size_; 53 return top_sites_prepopulated_pages_size_;
53 } 54 }
54 55
55 private: 56 private:
(...skipping 19 matching lines...) Expand all
75 get_top_sites_function->set_has_callback(true); 76 get_top_sites_function->set_has_callback(true);
76 77
77 std::unique_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( 78 std::unique_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult(
78 get_top_sites_function.get(), "[]", browser())); 79 get_top_sites_function.get(), "[]", browser()));
79 base::ListValue* list; 80 base::ListValue* list;
80 ASSERT_TRUE(result->GetAsList(&list)); 81 ASSERT_TRUE(result->GetAsList(&list));
81 EXPECT_GE(list->GetSize(), top_sites_prepopulated_pages_size()); 82 EXPECT_GE(list->GetSize(), top_sites_prepopulated_pages_size());
82 } 83 }
83 84
84 } // namespace extensions 85 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698