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

Side by Side Diff: chrome/browser/tab_contents/thumbnail_generator_unittest.cc

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
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"
11 #include "content/browser/renderer_host/backing_store_manager.h" 11 #include "content/browser/renderer_host/backing_store_manager.h"
12 #include "content/browser/renderer_host/backing_store_skia.h" 12 #include "content/browser/renderer_host/backing_store_skia.h"
13 #include "content/browser/renderer_host/mock_render_process_host.h" 13 #include "content/browser/renderer_host/mock_render_process_host.h"
14 #include "content/browser/renderer_host/test_render_view_host.h" 14 #include "content/browser/renderer_host/test_render_view_host.h"
15 #include "content/browser/tab_contents/render_view_host_manager.h" 15 #include "content/browser/tab_contents/render_view_host_manager.h"
16 #include "content/common/notification_service.h" 16 #include "content/public/browser/notification_service.h"
17 #include "content/common/view_messages.h" 17 #include "content/common/view_messages.h"
18 #include "content/public/browser/notification_types.h" 18 #include "content/public/browser/notification_types.h"
19 #include "skia/ext/platform_canvas.h" 19 #include "skia/ext/platform_canvas.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 #include "third_party/skia/include/core/SkColorPriv.h" 21 #include "third_party/skia/include/core/SkColorPriv.h"
22 #include "ui/gfx/canvas_skia.h" 22 #include "ui/gfx/canvas_skia.h"
23 #include "ui/gfx/surface/transport_dib.h" 23 #include "ui/gfx/surface/transport_dib.h"
24 24
25 static const int kBitmapWidth = 100; 25 static const int kBitmapWidth = 100;
26 static const int kBitmapHeight = 100; 26 static const int kBitmapHeight = 100;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 process_ = new MockRenderProcessHost(profile_.get()); 61 process_ = new MockRenderProcessHost(profile_.get());
62 widget_.reset(new RenderWidgetHost(process_, 1)); 62 widget_.reset(new RenderWidgetHost(process_, 1));
63 view_.reset(new TestRenderWidgetHostViewWithBackingStoreSkia( 63 view_.reset(new TestRenderWidgetHostViewWithBackingStoreSkia(
64 widget_.get())); 64 widget_.get()));
65 // Paiting will be skipped if there's no view. 65 // Paiting will be skipped if there's no view.
66 widget_->SetView(view_.get()); 66 widget_->SetView(view_.get());
67 67
68 // Need to send out a create notification for the RWH to get hooked. This is 68 // Need to send out a create notification for the RWH to get hooked. This is
69 // a little scary in that we don't have a RenderView, but the only listener 69 // a little scary in that we don't have a RenderView, but the only listener
70 // will want a RenderWidget, so it works out OK. 70 // will want a RenderWidget, so it works out OK.
71 NotificationService::current()->Notify( 71 content::NotificationService::current()->Notify(
72 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, 72 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB,
73 content::Source<RenderViewHostManager>(NULL), 73 content::Source<RenderViewHostManager>(NULL),
74 content::Details<RenderViewHost>(reinterpret_cast<RenderViewHost*>( 74 content::Details<RenderViewHost>(reinterpret_cast<RenderViewHost*>(
75 widget_.get()))); 75 widget_.get())));
76 76
77 transport_dib_.reset(TransportDIB::Create(kBitmapWidth * kBitmapHeight * 4, 77 transport_dib_.reset(TransportDIB::Create(kBitmapWidth * kBitmapHeight * 4,
78 1)); 78 1));
79 } 79 }
80 80
81 ~ThumbnailGeneratorTest() { 81 ~ThumbnailGeneratorTest() {
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 good_score.good_clipping = true; 405 good_score.good_clipping = true;
406 good_score.boring_score = 0.0; 406 good_score.boring_score = 0.0;
407 good_score.load_completed = true; 407 good_score.load_completed = true;
408 top_sites->AddKnownURL(kGoodURL, good_score); 408 top_sites->AddKnownURL(kGoodURL, good_score);
409 409
410 // Should be false, as the existing thumbnail is good enough (i.e. don't 410 // Should be false, as the existing thumbnail is good enough (i.e. don't
411 // need to replace the existing thumbnail which is new and good). 411 // need to replace the existing thumbnail which is new and good).
412 EXPECT_FALSE(ThumbnailGenerator::ShouldUpdateThumbnail( 412 EXPECT_FALSE(ThumbnailGenerator::ShouldUpdateThumbnail(
413 &profile, top_sites.get(), kGoodURL)); 413 &profile, top_sites.get(), kGoodURL));
414 } 414 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/thumbnail_generator.cc ('k') | chrome/browser/tab_contents/web_contents_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698