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/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 private: | 53 private: |
54 RenderWidgetHost* rwh_; | 54 RenderWidgetHost* rwh_; |
55 DISALLOW_COPY_AND_ASSIGN(TestRenderWidgetHostViewWithBackingStoreSkia); | 55 DISALLOW_COPY_AND_ASSIGN(TestRenderWidgetHostViewWithBackingStoreSkia); |
56 }; | 56 }; |
57 | 57 |
58 class ThumbnailGeneratorTest : public testing::Test { | 58 class ThumbnailGeneratorTest : public testing::Test { |
59 public: | 59 public: |
60 ThumbnailGeneratorTest() { | 60 ThumbnailGeneratorTest() { |
61 profile_.reset(new TestingProfile()); | 61 profile_.reset(new TestingProfile()); |
62 process_ = new MockRenderProcessHost(profile_.get()); | 62 process_ = new MockRenderProcessHost(profile_.get()); |
63 widget_.reset(new RenderWidgetHost(process_, 1)); | 63 widget_.reset(new RenderWidgetHost(process_, MSG_ROUTING_NONE)); |
64 view_.reset(new TestRenderWidgetHostViewWithBackingStoreSkia( | 64 view_.reset(new TestRenderWidgetHostViewWithBackingStoreSkia( |
65 widget_.get())); | 65 widget_.get())); |
66 // Paiting will be skipped if there's no view. | 66 // Paiting will be skipped if there's no view. |
67 widget_->SetView(view_.get()); | 67 widget_->SetView(view_.get()); |
68 | 68 |
69 // Need to send out a create notification for the RWH to get hooked. This is | 69 // Need to send out a create notification for the RWH to get hooked. This is |
70 // a little scary in that we don't have a RenderView, but the only listener | 70 // a little scary in that we don't have a RenderView, but the only listener |
71 // will want a RenderWidget, so it works out OK. | 71 // will want a RenderWidget, so it works out OK. |
72 content::NotificationService::current()->Notify( | 72 content::NotificationService::current()->Notify( |
73 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, | 73 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 good_score.good_clipping = true; | 398 good_score.good_clipping = true; |
399 good_score.boring_score = 0.0; | 399 good_score.boring_score = 0.0; |
400 good_score.load_completed = true; | 400 good_score.load_completed = true; |
401 top_sites->AddKnownURL(kGoodURL, good_score); | 401 top_sites->AddKnownURL(kGoodURL, good_score); |
402 | 402 |
403 // Should be false, as the existing thumbnail is good enough (i.e. don't | 403 // Should be false, as the existing thumbnail is good enough (i.e. don't |
404 // need to replace the existing thumbnail which is new and good). | 404 // need to replace the existing thumbnail which is new and good). |
405 EXPECT_FALSE(ThumbnailGenerator::ShouldUpdateThumbnail( | 405 EXPECT_FALSE(ThumbnailGenerator::ShouldUpdateThumbnail( |
406 &profile, top_sites.get(), kGoodURL)); | 406 &profile, top_sites.get(), kGoodURL)); |
407 } | 407 } |
OLD | NEW |