OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/surface/transport_dib.h" | 5 #include "app/surface/transport_dib.h" |
6 #include "base/basictypes.h" | 6 #include "base/basictypes.h" |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "chrome/browser/history/top_sites.h" | 8 #include "chrome/browser/history/top_sites.h" |
9 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 9 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
10 #include "chrome/common/notification_service.h" | 10 #include "chrome/common/notification_service.h" |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 scoped_refptr<MockTopSites> top_sites(new MockTopSites(&profile)); | 331 scoped_refptr<MockTopSites> top_sites(new MockTopSites(&profile)); |
332 | 332 |
333 // Should be false because it's a bad URL. | 333 // Should be false because it's a bad URL. |
334 EXPECT_FALSE(ThumbnailGenerator::ShouldUpdateThumbnail( | 334 EXPECT_FALSE(ThumbnailGenerator::ShouldUpdateThumbnail( |
335 &profile, top_sites.get(), kBadURL)); | 335 &profile, top_sites.get(), kBadURL)); |
336 | 336 |
337 // Should be true, as it's a good URL. | 337 // Should be true, as it's a good URL. |
338 EXPECT_TRUE(ThumbnailGenerator::ShouldUpdateThumbnail( | 338 EXPECT_TRUE(ThumbnailGenerator::ShouldUpdateThumbnail( |
339 &profile, top_sites.get(), kGoodURL)); | 339 &profile, top_sites.get(), kGoodURL)); |
340 | 340 |
341 // Should be false, if it's in the off-the-record mode. | 341 // Should be false, if it's in the incognito mode. |
342 profile.set_off_the_record(true); | 342 profile.set_off_the_record(true); |
343 EXPECT_FALSE(ThumbnailGenerator::ShouldUpdateThumbnail( | 343 EXPECT_FALSE(ThumbnailGenerator::ShouldUpdateThumbnail( |
344 &profile, top_sites.get(), kGoodURL)); | 344 &profile, top_sites.get(), kGoodURL)); |
345 | 345 |
346 // Should be true again, once turning off the off-the-record mode. | 346 // Should be true again, once turning off the incognito mode. |
347 profile.set_off_the_record(false); | 347 profile.set_off_the_record(false); |
348 EXPECT_TRUE(ThumbnailGenerator::ShouldUpdateThumbnail( | 348 EXPECT_TRUE(ThumbnailGenerator::ShouldUpdateThumbnail( |
349 &profile, top_sites.get(), kGoodURL)); | 349 &profile, top_sites.get(), kGoodURL)); |
350 | 350 |
351 // Add a known URL. This makes the top sites data full. | 351 // Add a known URL. This makes the top sites data full. |
352 ThumbnailScore bad_score; | 352 ThumbnailScore bad_score; |
353 bad_score.time_at_snapshot = base::Time::UnixEpoch(); // Ancient time stamp. | 353 bad_score.time_at_snapshot = base::Time::UnixEpoch(); // Ancient time stamp. |
354 top_sites->AddKnownURL(kGoodURL, bad_score); | 354 top_sites->AddKnownURL(kGoodURL, bad_score); |
355 ASSERT_TRUE(top_sites->IsFull()); | 355 ASSERT_TRUE(top_sites->IsFull()); |
356 | 356 |
(...skipping 13 matching lines...) Expand all Loading... |
370 good_score.at_top = true; | 370 good_score.at_top = true; |
371 good_score.good_clipping = true; | 371 good_score.good_clipping = true; |
372 good_score.boring_score = 0.0; | 372 good_score.boring_score = 0.0; |
373 top_sites->AddKnownURL(kGoodURL, good_score); | 373 top_sites->AddKnownURL(kGoodURL, good_score); |
374 | 374 |
375 // Should be false, as the existing thumbnail is good enough (i.e. don't | 375 // Should be false, as the existing thumbnail is good enough (i.e. don't |
376 // need to replace the existing thumbnail which is new and good). | 376 // need to replace the existing thumbnail which is new and good). |
377 EXPECT_FALSE(ThumbnailGenerator::ShouldUpdateThumbnail( | 377 EXPECT_FALSE(ThumbnailGenerator::ShouldUpdateThumbnail( |
378 &profile, top_sites.get(), kGoodURL)); | 378 &profile, top_sites.get(), kGoodURL)); |
379 } | 379 } |
OLD | NEW |