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

Side by Side Diff: chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc

Issue 1482183002: Fix content_setting_image_view compile on mac_views_browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: No real need for the other #defines either.. Created 5 years 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
OLDNEW
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 "base/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "chrome/browser/chrome_notification_types.h" 6 #include "chrome/browser/chrome_notification_types.h"
7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 8 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
9 #include "chrome/browser/prerender/prerender_manager.h" 9 #include "chrome/browser/prerender/prerender_manager.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" 11 #include "chrome/browser/ui/content_settings/content_setting_image_model.h"
12 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 12 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
13 #include "chrome/test/base/testing_profile.h" 13 #include "chrome/test/base/testing_profile.h"
14 #include "components/content_settings/core/browser/host_content_settings_map.h" 14 #include "components/content_settings/core/browser/host_content_settings_map.h"
15 #include "content/public/browser/notification_observer.h" 15 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h" 16 #include "content/public/browser/notification_registrar.h"
17 #include "content/public/browser/notification_service.h" 17 #include "content/public/browser/notification_service.h"
18 #include "content/public/test/test_renderer_host.h" 18 #include "content/public/test/test_renderer_host.h"
19 #include "net/cookies/cookie_options.h" 19 #include "net/cookies/cookie_options.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 #include "ui/gfx/color_palette.h" 21 #include "ui/gfx/color_palette.h"
22 22
23 namespace { 23 namespace {
24 24
25 bool HasIcon(const ContentSettingImageModel& model) { 25 bool HasIcon(const ContentSettingImageModel& model) {
26 #if defined(OS_MACOSX)
27 return !model.icon().IsEmpty();
28 #else
29 return !model.GetIcon(gfx::kPlaceholderColor).IsEmpty(); 26 return !model.GetIcon(gfx::kPlaceholderColor).IsEmpty();
30 #endif
31 } 27 }
32 28
33 // Forward all NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED to the specified 29 // Forward all NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED to the specified
34 // ContentSettingImageModel. 30 // ContentSettingImageModel.
35 class NotificationForwarder : public content::NotificationObserver { 31 class NotificationForwarder : public content::NotificationObserver {
36 public: 32 public:
37 explicit NotificationForwarder(ContentSettingImageModel* model) 33 explicit NotificationForwarder(ContentSettingImageModel* model)
38 : model_(model) { 34 : model_(model) {
39 registrar_.Add(this, 35 registrar_.Add(this,
40 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, 36 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 scoped_ptr<ContentSettingImageModel> content_setting_image_model = 128 scoped_ptr<ContentSettingImageModel> content_setting_image_model =
133 ContentSettingSimpleImageModel::CreateForContentTypeForTesting( 129 ContentSettingSimpleImageModel::CreateForContentTypeForTesting(
134 CONTENT_SETTINGS_TYPE_IMAGES); 130 CONTENT_SETTINGS_TYPE_IMAGES);
135 NotificationForwarder forwarder(content_setting_image_model.get()); 131 NotificationForwarder forwarder(content_setting_image_model.get());
136 // Should not crash. 132 // Should not crash.
137 TabSpecificContentSettings::CreateForWebContents(web_contents()); 133 TabSpecificContentSettings::CreateForWebContents(web_contents());
138 forwarder.clear(); 134 forwarder.clear();
139 } 135 }
140 136
141 } // namespace 137 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698