| OLD | NEW |
| 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 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h
" | 5 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h
" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/mac/scoped_nsautorelease_pool.h" | 9 #include "base/mac/scoped_nsautorelease_pool.h" |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| 11 #include "chrome/browser/chrome_content_browser_client.h" |
| 11 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 12 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
| 12 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 13 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 13 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 14 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
| 15 #include "chrome/common/chrome_content_client.h" |
| 14 #include "chrome/common/content_settings_types.h" | 16 #include "chrome/common/content_settings_types.h" |
| 15 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 17 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 18 #include "chrome/test/base/chrome_unit_test_suite.h" |
| 16 #include "chrome/test/base/testing_browser_process.h" | 19 #include "chrome/test/base/testing_browser_process.h" |
| 17 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
| 18 #include "content/public/common/media_stream_request.h" | 21 #include "content/public/common/media_stream_request.h" |
| 19 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 21 #include "testing/gtest_mac.h" | 24 #include "testing/gtest_mac.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
| 23 | 26 |
| 24 namespace { | 27 namespace { |
| 25 | 28 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 42 } | 45 } |
| 43 }; | 46 }; |
| 44 | 47 |
| 45 class ContentSettingBubbleControllerTest | 48 class ContentSettingBubbleControllerTest |
| 46 : public ChromeRenderViewHostTestHarness { | 49 : public ChromeRenderViewHostTestHarness { |
| 47 protected: | 50 protected: |
| 48 // Helper function to create the bubble controller. | 51 // Helper function to create the bubble controller. |
| 49 ContentSettingBubbleController* CreateBubbleController( | 52 ContentSettingBubbleController* CreateBubbleController( |
| 50 ContentSettingsType settingsType); | 53 ContentSettingsType settingsType); |
| 51 | 54 |
| 55 virtual void SetUp() OVERRIDE { |
| 56 ChromeUnitTestSuite::InitializeProviders(); |
| 57 ChromeUnitTestSuite::InitializeResourceBundle(); |
| 58 content_client_.reset(new ChromeContentClient); |
| 59 content::SetContentClient(content_client_.get()); |
| 60 browser_content_client_.reset(new chrome::ChromeContentBrowserClient()); |
| 61 content::SetBrowserClientForTesting(browser_content_client_.get()); |
| 62 initializer_.reset(new TestingBrowserProcessInitializer); |
| 63 ChromeRenderViewHostTestHarness::SetUp(); |
| 64 } |
| 65 |
| 66 scoped_ptr<ChromeContentClient> content_client_; |
| 67 scoped_ptr<chrome::ChromeContentBrowserClient> browser_content_client_; |
| 68 |
| 52 // This is a unit test running in the browser_tests suite, so we must create | 69 // This is a unit test running in the browser_tests suite, so we must create |
| 53 // the TestingBrowserProcess manually. Must be first member. | 70 // the TestingBrowserProcess manually. Must be first member. |
| 54 TestingBrowserProcessInitializer initializer_; | 71 scoped_ptr<TestingBrowserProcessInitializer> initializer_; |
| 55 | 72 |
| 56 base::scoped_nsobject<NSWindow> parent_; | 73 base::scoped_nsobject<NSWindow> parent_; |
| 57 | 74 |
| 58 private: | 75 private: |
| 59 base::mac::ScopedNSAutoreleasePool pool_; | 76 base::mac::ScopedNSAutoreleasePool pool_; |
| 60 }; | 77 }; |
| 61 | 78 |
| 62 ContentSettingBubbleController* | 79 ContentSettingBubbleController* |
| 63 ContentSettingBubbleControllerTest::CreateBubbleController( | 80 ContentSettingBubbleControllerTest::CreateBubbleController( |
| 64 ContentSettingsType settingsType) { | 81 ContentSettingsType settingsType) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 (content::MEDIA_DEVICE_VIDEO_CAPTURE == i->second->type)); | 140 (content::MEDIA_DEVICE_VIDEO_CAPTURE == i->second->type)); |
| 124 EXPECT_EQ(0, [i->first numberOfItems]); | 141 EXPECT_EQ(0, [i->first numberOfItems]); |
| 125 EXPECT_NSEQ(title, [i->first title]); | 142 EXPECT_NSEQ(title, [i->first title]); |
| 126 EXPECT_FALSE([i->first isEnabled]); | 143 EXPECT_FALSE([i->first isEnabled]); |
| 127 } | 144 } |
| 128 | 145 |
| 129 [parent_ close]; | 146 [parent_ close]; |
| 130 } | 147 } |
| 131 | 148 |
| 132 } // namespace | 149 } // namespace |
| OLD | NEW |