| OLD | NEW |
| 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 "components/history/core/browser/history_backend.h" | 5 #include "components/history/core/browser/history_backend.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 *bitmap_data->front() == expected_data; | 478 *bitmap_data->front() == expected_data; |
| 479 } | 479 } |
| 480 | 480 |
| 481 // Returns true if |bitmap_data| is of |color|. | 481 // Returns true if |bitmap_data| is of |color|. |
| 482 bool BitmapColorEqual(SkColor expected_color, | 482 bool BitmapColorEqual(SkColor expected_color, |
| 483 scoped_refptr<base::RefCountedMemory> bitmap_data) { | 483 scoped_refptr<base::RefCountedMemory> bitmap_data) { |
| 484 SkBitmap bitmap; | 484 SkBitmap bitmap; |
| 485 if (!gfx::PNGCodec::Decode(bitmap_data->front(), bitmap_data->size(), | 485 if (!gfx::PNGCodec::Decode(bitmap_data->front(), bitmap_data->size(), |
| 486 &bitmap)) | 486 &bitmap)) |
| 487 return false; | 487 return false; |
| 488 SkAutoLockPixels bitmap_lock(bitmap); | |
| 489 return expected_color == bitmap.getColor(0, 0); | 488 return expected_color == bitmap.getColor(0, 0); |
| 490 } | 489 } |
| 491 | 490 |
| 492 private: | 491 private: |
| 493 DISALLOW_COPY_AND_ASSIGN(HistoryBackendTest); | 492 DISALLOW_COPY_AND_ASSIGN(HistoryBackendTest); |
| 494 }; | 493 }; |
| 495 | 494 |
| 496 class InMemoryHistoryBackendTest : public HistoryBackendTestBase { | 495 class InMemoryHistoryBackendTest : public HistoryBackendTestBase { |
| 497 public: | 496 public: |
| 498 InMemoryHistoryBackendTest() {} | 497 InMemoryHistoryBackendTest() {} |
| (...skipping 3427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3926 backend_->QueryMostVisitedURLs(100, 100, &most_visited); | 3925 backend_->QueryMostVisitedURLs(100, 100, &most_visited); |
| 3927 | 3926 |
| 3928 const base::string16 kSomeTitle; // Ignored by equality operator. | 3927 const base::string16 kSomeTitle; // Ignored by equality operator. |
| 3929 EXPECT_THAT( | 3928 EXPECT_THAT( |
| 3930 most_visited, | 3929 most_visited, |
| 3931 ElementsAre(MostVisitedURL(GURL("http://example1.com"), kSomeTitle), | 3930 ElementsAre(MostVisitedURL(GURL("http://example1.com"), kSomeTitle), |
| 3932 MostVisitedURL(GURL("http://example5.com"), kSomeTitle))); | 3931 MostVisitedURL(GURL("http://example5.com"), kSomeTitle))); |
| 3933 } | 3932 } |
| 3934 | 3933 |
| 3935 } // namespace history | 3934 } // namespace history |
| OLD | NEW |