| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #import "chrome/browser/cocoa/geolocation_exceptions_window_controller.h" | 5 #import "chrome/browser/cocoa/geolocation_exceptions_window_controller.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #import "base/scoped_nsobject.h" | 9 #import "base/scoped_nsobject.h" |
| 10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 } | 24 } |
| 25 | 25 |
| 26 GeolocationExceptionsWindowController* GetController() { | 26 GeolocationExceptionsWindowController* GetController() { |
| 27 id controller = [GeolocationExceptionsWindowController | 27 id controller = [GeolocationExceptionsWindowController |
| 28 controllerWithSettingsMap:settingsMap_.get()]; | 28 controllerWithSettingsMap:settingsMap_.get()]; |
| 29 [controller showWindow:nil]; | 29 [controller showWindow:nil]; |
| 30 return controller; | 30 return controller; |
| 31 } | 31 } |
| 32 | 32 |
| 33 void ClickRemoveAll(GeolocationExceptionsWindowController* controller) { | 33 void ClickRemoveAll(GeolocationExceptionsWindowController* controller) { |
| 34 [controller removeAllExceptions:nil]; | 34 [controller removeAll:nil]; |
| 35 } | 35 } |
| 36 | 36 |
| 37 protected: | 37 protected: |
| 38 BrowserTestHelper browser_helper_; | 38 BrowserTestHelper browser_helper_; |
| 39 scoped_refptr<GeolocationContentSettingsMap> settingsMap_; | 39 scoped_refptr<GeolocationContentSettingsMap> settingsMap_; |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 TEST_F(GeolocationExceptionsWindowControllerTest, Construction) { | 42 TEST_F(GeolocationExceptionsWindowControllerTest, Construction) { |
| 43 GeolocationExceptionsWindowController* controller = | 43 GeolocationExceptionsWindowController* controller = |
| 44 [GeolocationExceptionsWindowController | 44 [GeolocationExceptionsWindowController |
| 45 controllerWithSettingsMap:settingsMap_.get()]; | 45 controllerWithSettingsMap:settingsMap_.get()]; |
| 46 [controller showWindow:nil]; | 46 [controller showWindow:nil]; |
| 47 [controller close]; // Should autorelease. | 47 [controller close]; // Should autorelease. |
| 48 } | 48 } |
| 49 | 49 |
| 50 TEST_F(GeolocationExceptionsWindowControllerTest, AddExistingEditAdd) { | 50 TEST_F(GeolocationExceptionsWindowControllerTest, AddExistingEditAdd) { |
| 51 settingsMap_->SetContentSetting( | 51 settingsMap_->SetContentSetting( |
| 52 GURL("http://myhost"), GURL(), CONTENT_SETTING_BLOCK); | 52 GURL("http://myhost"), GURL(), CONTENT_SETTING_BLOCK); |
| 53 | 53 |
| 54 GeolocationExceptionsWindowController* controller = GetController(); | 54 GeolocationExceptionsWindowController* controller = GetController(); |
| 55 ClickRemoveAll(controller); | 55 ClickRemoveAll(controller); |
| 56 | 56 |
| 57 [controller close]; | 57 [controller close]; |
| 58 | 58 |
| 59 EXPECT_EQ(0u, settingsMap_->GetAllOriginsSettings().size()); | 59 EXPECT_EQ(0u, settingsMap_->GetAllOriginsSettings().size()); |
| 60 } | 60 } |
| 61 | 61 |
| 62 } // namespace | 62 } // namespace |
| OLD | NEW |