OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/stringprintf.h" | 6 #include "base/stringprintf.h" |
7 #include "chrome/browser/history/top_sites.h" | 7 #include "chrome/browser/history/top_sites.h" |
8 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 8 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
10 #include "chrome/test/testing_profile.h" | 10 #include "chrome/test/testing_profile.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 widget_.reset(new RenderWidgetHost(process_, 1)); | 61 widget_.reset(new RenderWidgetHost(process_, 1)); |
62 view_.reset(new TestRenderWidgetHostViewWithBackingStoreSkia( | 62 view_.reset(new TestRenderWidgetHostViewWithBackingStoreSkia( |
63 widget_.get())); | 63 widget_.get())); |
64 // Paiting will be skipped if there's no view. | 64 // Paiting will be skipped if there's no view. |
65 widget_->SetView(view_.get()); | 65 widget_->SetView(view_.get()); |
66 | 66 |
67 // Need to send out a create notification for the RWH to get hooked. This is | 67 // Need to send out a create notification for the RWH to get hooked. This is |
68 // a little scary in that we don't have a RenderView, but the only listener | 68 // a little scary in that we don't have a RenderView, but the only listener |
69 // will want a RenderWidget, so it works out OK. | 69 // will want a RenderWidget, so it works out OK. |
70 NotificationService::current()->Notify( | 70 NotificationService::current()->Notify( |
71 NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, | 71 chrome::RENDER_VIEW_HOST_CREATED_FOR_TAB, |
72 Source<RenderViewHostManager>(NULL), | 72 Source<RenderViewHostManager>(NULL), |
73 Details<RenderViewHost>(reinterpret_cast<RenderViewHost*>( | 73 Details<RenderViewHost>(reinterpret_cast<RenderViewHost*>( |
74 widget_.get()))); | 74 widget_.get()))); |
75 | 75 |
76 transport_dib_.reset(TransportDIB::Create(kBitmapWidth * kBitmapHeight * 4, | 76 transport_dib_.reset(TransportDIB::Create(kBitmapWidth * kBitmapHeight * 4, |
77 1)); | 77 1)); |
78 } | 78 } |
79 | 79 |
80 ~ThumbnailGeneratorTest() { | 80 ~ThumbnailGeneratorTest() { |
81 view_.reset(); | 81 view_.reset(); |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 good_score.good_clipping = true; | 396 good_score.good_clipping = true; |
397 good_score.boring_score = 0.0; | 397 good_score.boring_score = 0.0; |
398 good_score.load_completed = true; | 398 good_score.load_completed = true; |
399 top_sites->AddKnownURL(kGoodURL, good_score); | 399 top_sites->AddKnownURL(kGoodURL, good_score); |
400 | 400 |
401 // Should be false, as the existing thumbnail is good enough (i.e. don't | 401 // Should be false, as the existing thumbnail is good enough (i.e. don't |
402 // need to replace the existing thumbnail which is new and good). | 402 // need to replace the existing thumbnail which is new and good). |
403 EXPECT_FALSE(ThumbnailGenerator::ShouldUpdateThumbnail( | 403 EXPECT_FALSE(ThumbnailGenerator::ShouldUpdateThumbnail( |
404 &profile, top_sites.get(), kGoodURL)); | 404 &profile, top_sites.get(), kGoodURL)); |
405 } | 405 } |
OLD | NEW |