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

Side by Side Diff: chrome/browser/history/history_backend_unittest.cc

Issue 232483005: Enable --high-dpi-support by default. Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Disabling broken unit tests. (Don't submit this code!) Created 6 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
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 "chrome/browser/history/history_backend.h" 5 #include "chrome/browser/history/history_backend.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 23 matching lines...) Expand all
34 #include "chrome/test/base/testing_profile.h" 34 #include "chrome/test/base/testing_profile.h"
35 #include "components/bookmarks/core/browser/bookmark_model.h" 35 #include "components/bookmarks/core/browser/bookmark_model.h"
36 #include "components/bookmarks/core/browser/bookmark_utils.h" 36 #include "components/bookmarks/core/browser/bookmark_utils.h"
37 #include "components/bookmarks/core/test/bookmark_test_helpers.h" 37 #include "components/bookmarks/core/test/bookmark_test_helpers.h"
38 #include "components/bookmarks/core/test/test_bookmark_client.h" 38 #include "components/bookmarks/core/test/test_bookmark_client.h"
39 #include "content/public/browser/notification_details.h" 39 #include "content/public/browser/notification_details.h"
40 #include "content/public/browser/notification_source.h" 40 #include "content/public/browser/notification_source.h"
41 #include "content/public/test/test_browser_thread.h" 41 #include "content/public/test/test_browser_thread.h"
42 #include "testing/gtest/include/gtest/gtest.h" 42 #include "testing/gtest/include/gtest/gtest.h"
43 #include "url/gurl.h" 43 #include "url/gurl.h"
44 #if defined(OS_WIN)
45 #include "ui/gfx/win/dpi.h"
46 #endif
44 47
45 using base::Time; 48 using base::Time;
46 49
47 // This file only tests functionality where it is most convenient to call the 50 // This file only tests functionality where it is most convenient to call the
48 // backend directly. Most of the history backend functions are tested by the 51 // backend directly. Most of the history backend functions are tested by the
49 // history unit test. Because of the elaborate callbacks involved, this is no 52 // history unit test. Because of the elaborate callbacks involved, this is no
50 // harder than calling it directly for many things. 53 // harder than calling it directly for many things.
51 54
52 namespace { 55 namespace {
53 56
(...skipping 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after
2166 EXPECT_EQ(1u, icon_mappings.size()); 2169 EXPECT_EQ(1u, icon_mappings.size());
2167 std::vector<FaviconBitmap> favicon_bitmaps; 2170 std::vector<FaviconBitmap> favicon_bitmaps;
2168 EXPECT_TRUE(backend_->thumbnail_db_->GetFaviconBitmaps( 2171 EXPECT_TRUE(backend_->thumbnail_db_->GetFaviconBitmaps(
2169 icon_mappings[0].icon_id, &favicon_bitmaps)); 2172 icon_mappings[0].icon_id, &favicon_bitmaps));
2170 EXPECT_EQ(kMaxFaviconBitmapsPerIconURL, favicon_bitmaps.size()); 2173 EXPECT_EQ(kMaxFaviconBitmapsPerIconURL, favicon_bitmaps.size());
2171 } 2174 }
2172 2175
2173 // Tests that the favicon set by MergeFavicon() shows up in the result of 2176 // Tests that the favicon set by MergeFavicon() shows up in the result of
2174 // GetFaviconsForURL(). 2177 // GetFaviconsForURL().
2175 TEST_F(HistoryBackendTest, MergeFaviconShowsUpInGetFaviconsForURLResult) { 2178 TEST_F(HistoryBackendTest, MergeFaviconShowsUpInGetFaviconsForURLResult) {
2179 #if defined(OS_WIN)
2180 // High DPI breaks multi-resolution handling. Bail.
2181 if (gfx::IsHighDPIEnabled())
2182 return;
2183 #endif
2176 GURL page_url("http://www.google.com"); 2184 GURL page_url("http://www.google.com");
2177 GURL icon_url("http://www.google.com/favicon.ico"); 2185 GURL icon_url("http://www.google.com/favicon.ico");
2178 GURL merged_icon_url("http://wwww.google.com/favicon2.ico"); 2186 GURL merged_icon_url("http://wwww.google.com/favicon2.ico");
2179 2187
2180 std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; 2188 std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data;
2181 GenerateFaviconBitmapData(icon_url, GetSizesSmallAndLarge(), 2189 GenerateFaviconBitmapData(icon_url, GetSizesSmallAndLarge(),
2182 &favicon_bitmap_data); 2190 &favicon_bitmap_data);
2183 2191
2184 // Set some preexisting favicons for |page_url|. 2192 // Set some preexisting favicons for |page_url|.
2185 backend_->SetFavicons(page_url, favicon_base::FAVICON, favicon_bitmap_data); 2193 backend_->SetFavicons(page_url, favicon_base::FAVICON, favicon_bitmap_data);
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
2458 EXPECT_FALSE(bitmap_results_out[1].expired); 2466 EXPECT_FALSE(bitmap_results_out[1].expired);
2459 EXPECT_TRUE(BitmapDataEqual('c', bitmap_results_out[1].bitmap_data)); 2467 EXPECT_TRUE(BitmapDataEqual('c', bitmap_results_out[1].bitmap_data));
2460 EXPECT_EQ(kLargeSize, bitmap_results_out[1].pixel_size); 2468 EXPECT_EQ(kLargeSize, bitmap_results_out[1].pixel_size);
2461 EXPECT_EQ(icon_url, bitmap_results_out[1].icon_url); 2469 EXPECT_EQ(icon_url, bitmap_results_out[1].icon_url);
2462 EXPECT_EQ(favicon_base::FAVICON, bitmap_results_out[1].icon_type); 2470 EXPECT_EQ(favicon_base::FAVICON, bitmap_results_out[1].icon_type);
2463 } 2471 }
2464 2472
2465 // Test that GetFaviconsFromDB() returns results from the icon URL whose 2473 // Test that GetFaviconsFromDB() returns results from the icon URL whose
2466 // bitmaps most closely match the passed in desired size and scale factors. 2474 // bitmaps most closely match the passed in desired size and scale factors.
2467 TEST_F(HistoryBackendTest, GetFaviconsFromDBSingleIconURL) { 2475 TEST_F(HistoryBackendTest, GetFaviconsFromDBSingleIconURL) {
2476 #if defined(OS_WIN)
2477 // High DPI breaks multi-resolution handling. Bail.
2478 if (gfx::IsHighDPIEnabled())
2479 return;
2480 #endif
2468 const GURL page_url("http://www.google.com/"); 2481 const GURL page_url("http://www.google.com/");
2469
2470 const GURL icon_url1("http://www.google.com/icon1"); 2482 const GURL icon_url1("http://www.google.com/icon1");
2471 const GURL icon_url2("http://www.google.com/icon2"); 2483 const GURL icon_url2("http://www.google.com/icon2");
2472 2484
2473 std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; 2485 std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data;
2474 GenerateFaviconBitmapData(icon_url1, GetSizesSmall(), icon_url2, 2486 GenerateFaviconBitmapData(icon_url1, GetSizesSmall(), icon_url2,
2475 GetSizesLarge(), &favicon_bitmap_data); 2487 GetSizesLarge(), &favicon_bitmap_data);
2476 2488
2477 backend_->SetFavicons(page_url, favicon_base::FAVICON, favicon_bitmap_data); 2489 backend_->SetFavicons(page_url, favicon_base::FAVICON, favicon_bitmap_data);
2478 2490
2479 std::vector<favicon_base::FaviconBitmapResult> bitmap_results_out; 2491 std::vector<favicon_base::FaviconBitmapResult> bitmap_results_out;
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
3384 // Verify that the second term is no longer returned as result, and also check 3396 // Verify that the second term is no longer returned as result, and also check
3385 // at the low level that it is gone for good. The term corresponding to the 3397 // at the low level that it is gone for good. The term corresponding to the
3386 // first URLRow should not be affected. 3398 // first URLRow should not be affected.
3387 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1)); 3399 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1));
3388 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2)); 3400 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2));
3389 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL)); 3401 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL));
3390 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL)); 3402 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL));
3391 } 3403 }
3392 3404
3393 } // namespace history 3405 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/favicon/favicon_handler_unittest.cc ('k') | chrome/browser/history/select_favicon_frames_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698