diff options
author | Iain Merrick <husky@google.com> | 2010-10-19 14:37:37 +0100 |
---|---|---|
committer | Iain Merrick <husky@google.com> | 2010-10-19 14:37:37 +0100 |
commit | 3345a6884c488ff3a535c2c9acdd33d74b37e311 (patch) | |
tree | 7784b988ef1698cb6967ea1bdf07616237716c6c /chrome/browser/cocoa/simple_content_exceptions_window_controller_unittest.mm | |
parent | efc8475837ec58186051f23bb03542620424f6ce (diff) | |
download | external_chromium-3345a6884c488ff3a535c2c9acdd33d74b37e311.zip external_chromium-3345a6884c488ff3a535c2c9acdd33d74b37e311.tar.gz external_chromium-3345a6884c488ff3a535c2c9acdd33d74b37e311.tar.bz2 |
Merge Chromium at 7.0.540.0 : Initial merge by git
Not including third_party/icu as it contains huge data files that break Gerrit, and aren't actually used.
Change-Id: I428a386e70f3b58cacd28677b8cfda282e891e15
Diffstat (limited to 'chrome/browser/cocoa/simple_content_exceptions_window_controller_unittest.mm')
-rw-r--r-- | chrome/browser/cocoa/simple_content_exceptions_window_controller_unittest.mm | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/chrome/browser/cocoa/simple_content_exceptions_window_controller_unittest.mm b/chrome/browser/cocoa/simple_content_exceptions_window_controller_unittest.mm index 34e96a5..05b025c 100644 --- a/chrome/browser/cocoa/simple_content_exceptions_window_controller_unittest.mm +++ b/chrome/browser/cocoa/simple_content_exceptions_window_controller_unittest.mm @@ -11,9 +11,26 @@ #include "chrome/browser/cocoa/browser_test_helper.h" #include "chrome/browser/cocoa/cocoa_test_helper.h" #include "chrome/browser/geolocation/geolocation_exceptions_table_model.h" +#include "chrome/browser/host_content_settings_map.h" +#include "chrome/browser/plugin_exceptions_table_model.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" +@interface SimpleContentExceptionsWindowController (Testing) + +@property(readonly, nonatomic) TableModelArrayController* arrayController; + +@end + +@implementation SimpleContentExceptionsWindowController (Testing) + +- (TableModelArrayController*)arrayController { + return arrayController_; +} + +@end + + namespace { class SimpleContentExceptionsWindowControllerTest : public CocoaTest { @@ -21,12 +38,13 @@ class SimpleContentExceptionsWindowControllerTest : public CocoaTest { virtual void SetUp() { CocoaTest::SetUp(); TestingProfile* profile = browser_helper_.profile(); - settingsMap_ = new GeolocationContentSettingsMap(profile); + geolocation_settings_ = new GeolocationContentSettingsMap(profile); + content_settings_ = new HostContentSettingsMap(profile); } SimpleContentExceptionsWindowController* GetController() { - GeolocationExceptionsTableModel* model = // Freed by window controller. - new GeolocationExceptionsTableModel(settingsMap_.get()); + GeolocationExceptionsTableModel* model = // Freed by window controller. + new GeolocationExceptionsTableModel(geolocation_settings_.get()); id controller = [SimpleContentExceptionsWindowController controllerWithTableModel:model]; [controller showWindow:nil]; @@ -34,17 +52,27 @@ class SimpleContentExceptionsWindowControllerTest : public CocoaTest { } void ClickRemoveAll(SimpleContentExceptionsWindowController* controller) { - [controller removeAll:nil]; + [controller.arrayController removeAll:nil]; } protected: BrowserTestHelper browser_helper_; - scoped_refptr<GeolocationContentSettingsMap> settingsMap_; + scoped_refptr<GeolocationContentSettingsMap> geolocation_settings_; + scoped_refptr<HostContentSettingsMap> content_settings_; }; TEST_F(SimpleContentExceptionsWindowControllerTest, Construction) { GeolocationExceptionsTableModel* model = // Freed by window controller. - new GeolocationExceptionsTableModel(settingsMap_.get()); + new GeolocationExceptionsTableModel(geolocation_settings_.get()); + SimpleContentExceptionsWindowController* controller = + [SimpleContentExceptionsWindowController controllerWithTableModel:model]; + [controller showWindow:nil]; + [controller close]; // Should autorelease. +} + +TEST_F(SimpleContentExceptionsWindowControllerTest, ShowPluginExceptions) { + PluginExceptionsTableModel* model = // Freed by window controller. + new PluginExceptionsTableModel(content_settings_.get(), NULL); SimpleContentExceptionsWindowController* controller = [SimpleContentExceptionsWindowController controllerWithTableModel:model]; [controller showWindow:nil]; @@ -52,7 +80,7 @@ TEST_F(SimpleContentExceptionsWindowControllerTest, Construction) { } TEST_F(SimpleContentExceptionsWindowControllerTest, AddExistingEditAdd) { - settingsMap_->SetContentSetting( + geolocation_settings_->SetContentSetting( GURL("http://myhost"), GURL(), CONTENT_SETTING_BLOCK); SimpleContentExceptionsWindowController* controller = GetController(); @@ -60,7 +88,7 @@ TEST_F(SimpleContentExceptionsWindowControllerTest, AddExistingEditAdd) { [controller close]; - EXPECT_EQ(0u, settingsMap_->GetAllOriginsSettings().size()); + EXPECT_EQ(0u, geolocation_settings_->GetAllOriginsSettings().size()); } } // namespace |