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

Side by Side Diff: chrome/browser/ui/webui/favicon_source_unittest.cc

Issue 14307023: chrome: Use base::MessageLoop. (Part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/webui/favicon_source.h" 5 #include "chrome/browser/ui/webui/favicon_source.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "chrome/browser/search/instant_service.h" 9 #include "chrome/browser/search/instant_service.h"
10 #include "chrome/browser/search/instant_service_factory.h" 10 #include "chrome/browser/search/instant_service_factory.h"
11 #include "chrome/test/base/testing_profile.h" 11 #include "chrome/test/base/testing_profile.h"
12 #include "content/public/test/test_browser_thread.h" 12 #include "content/public/test/test_browser_thread.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "ui/base/layout.h" 14 #include "ui/base/layout.h"
15 15
16 class FaviconSourceTest : public testing::Test { 16 class FaviconSourceTest : public testing::Test {
17 public: 17 public:
18 FaviconSourceTest() 18 FaviconSourceTest()
19 : loop_(MessageLoop::TYPE_UI), 19 : loop_(base::MessageLoop::TYPE_UI),
20 ui_thread_(content::BrowserThread::UI, MessageLoop::current()), 20 ui_thread_(content::BrowserThread::UI, base::MessageLoop::current()),
21 io_thread_(content::BrowserThread::IO, MessageLoop::current()), 21 io_thread_(content::BrowserThread::IO, base::MessageLoop::current()),
22 profile_(new TestingProfile()), 22 profile_(new TestingProfile()),
23 favicon_source_( 23 favicon_source_(
24 new FaviconSource(profile_.get(), FaviconSource::ANY)) { 24 new FaviconSource(profile_.get(), FaviconSource::ANY)) {
25 25
26 // Set the supported scale factors because the supported scale factors 26 // Set the supported scale factors because the supported scale factors
27 // affect the result of ParsePathAndScale(). 27 // affect the result of ParsePathAndScale().
28 std::vector<ui::ScaleFactor> supported_scale_factors; 28 std::vector<ui::ScaleFactor> supported_scale_factors;
29 supported_scale_factors.push_back(ui::SCALE_FACTOR_100P); 29 supported_scale_factors.push_back(ui::SCALE_FACTOR_100P);
30 supported_scale_factors.push_back(ui::SCALE_FACTOR_140P); 30 supported_scale_factors.push_back(ui::SCALE_FACTOR_140P);
31 scoped_set_supported_scale_factors_.reset( 31 scoped_set_supported_scale_factors_.reset(
(...skipping 16 matching lines...) Expand all
48 48
49 std::vector<InstantMostVisitedItemIDPair> items_with_ids; 49 std::vector<InstantMostVisitedItemIDPair> items_with_ids;
50 instant_service->GetCurrentMostVisitedItems(&items_with_ids); 50 instant_service->GetCurrentMostVisitedItems(&items_with_ids);
51 CHECK_EQ(1u, items_with_ids.size()); 51 CHECK_EQ(1u, items_with_ids.size());
52 return items_with_ids[0].first; 52 return items_with_ids[0].first;
53 } 53 }
54 54
55 FaviconSource* favicon_source() const { return favicon_source_.get(); } 55 FaviconSource* favicon_source() const { return favicon_source_.get(); }
56 56
57 private: 57 private:
58 MessageLoop loop_; 58 base::MessageLoop loop_;
59 content::TestBrowserThread ui_thread_; 59 content::TestBrowserThread ui_thread_;
60 content::TestBrowserThread io_thread_; 60 content::TestBrowserThread io_thread_;
61 scoped_ptr<TestingProfile> profile_; 61 scoped_ptr<TestingProfile> profile_;
62 62
63 typedef scoped_ptr<ui::test::ScopedSetSupportedScaleFactors> 63 typedef scoped_ptr<ui::test::ScopedSetSupportedScaleFactors>
64 ScopedSetSupportedScaleFactors; 64 ScopedSetSupportedScaleFactors;
65 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; 65 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_;
66 66
67 scoped_ptr<FaviconSource> favicon_source_; 67 scoped_ptr<FaviconSource> favicon_source_;
68 68
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 EXPECT_EQ(ui::SCALE_FACTOR_140P, scale_factor); 212 EXPECT_EQ(ui::SCALE_FACTOR_140P, scale_factor);
213 213
214 const std::string path14 = 214 const std::string path14 =
215 "largest/iconurl/http://www.google.com/favicon.ico"; 215 "largest/iconurl/http://www.google.com/favicon.ico";
216 EXPECT_TRUE(favicon_source()->ParsePath(path14, &is_icon_url, &url, 216 EXPECT_TRUE(favicon_source()->ParsePath(path14, &is_icon_url, &url,
217 &size_in_dip, &scale_factor)); 217 &size_in_dip, &scale_factor));
218 EXPECT_TRUE(is_icon_url); 218 EXPECT_TRUE(is_icon_url);
219 EXPECT_EQ("http://www.google.com/favicon.ico", url.spec()); 219 EXPECT_EQ("http://www.google.com/favicon.ico", url.spec());
220 EXPECT_EQ(0, size_in_dip); 220 EXPECT_EQ(0, size_in_dip);
221 } 221 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc ('k') | chrome/browser/ui/webui/fileicon_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698