OLD | NEW |
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/auto_reset.h" | 5 #include "base/auto_reset.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/mock_plugin_exceptions_table_model.h" | 8 #include "chrome/browser/mock_plugin_exceptions_table_model.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/test/base/testing_pref_service.h" | 10 #include "chrome/test/base/testing_pref_service.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 CONTENT_SETTINGS_TYPE_PLUGINS, | 86 CONTENT_SETTINGS_TYPE_PLUGINS, |
87 "b-bar", | 87 "b-bar", |
88 CONTENT_SETTING_ALLOW); | 88 CONTENT_SETTING_ALLOW); |
89 | 89 |
90 table_model_.reset(new MockPluginExceptionsTableModel(map, NULL)); | 90 table_model_.reset(new MockPluginExceptionsTableModel(map, NULL)); |
91 | 91 |
92 std::vector<webkit::npapi::PluginGroup> plugins; | 92 std::vector<webkit::npapi::PluginGroup> plugins; |
93 webkit::WebPluginInfo foo_plugin; | 93 webkit::WebPluginInfo foo_plugin; |
94 foo_plugin.path = FilePath(FILE_PATH_LITERAL("a-foo")); | 94 foo_plugin.path = FilePath(FILE_PATH_LITERAL("a-foo")); |
95 foo_plugin.name = ASCIIToUTF16("FooPlugin"); | 95 foo_plugin.name = ASCIIToUTF16("FooPlugin"); |
| 96 foo_plugin.enabled = |
| 97 webkit::WebPluginInfo::USER_ENABLED_POLICY_UNMANAGED; |
96 scoped_ptr<webkit::npapi::PluginGroup> foo_group( | 98 scoped_ptr<webkit::npapi::PluginGroup> foo_group( |
97 webkit::npapi::PluginGroup::FromWebPluginInfo(foo_plugin)); | 99 webkit::npapi::PluginGroup::FromWebPluginInfo(foo_plugin)); |
98 plugins.push_back(*foo_group); | 100 plugins.push_back(*foo_group); |
99 | 101 |
100 webkit::WebPluginInfo bar_plugin; | 102 webkit::WebPluginInfo bar_plugin; |
101 bar_plugin.path = FilePath(FILE_PATH_LITERAL("b-bar")); | 103 bar_plugin.path = FilePath(FILE_PATH_LITERAL("b-bar")); |
102 bar_plugin.name = ASCIIToUTF16("BarPlugin"); | 104 bar_plugin.name = ASCIIToUTF16("BarPlugin"); |
| 105 bar_plugin.enabled = |
| 106 webkit::WebPluginInfo::USER_ENABLED_POLICY_UNMANAGED; |
103 scoped_ptr<webkit::npapi::PluginGroup> bar_group( | 107 scoped_ptr<webkit::npapi::PluginGroup> bar_group( |
104 webkit::npapi::PluginGroup::FromWebPluginInfo(bar_plugin)); | 108 webkit::npapi::PluginGroup::FromWebPluginInfo(bar_plugin)); |
105 plugins.push_back(*bar_group); | 109 plugins.push_back(*bar_group); |
106 | 110 |
107 table_model_->set_plugins(plugins); | 111 table_model_->set_plugins(plugins); |
108 table_model_->ReloadSettings(); | 112 table_model_->ReloadSettings(); |
109 } | 113 } |
110 | 114 |
111 protected: | 115 protected: |
112 void CheckInvariants() const { | 116 void CheckInvariants() const { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 plugin_test_internal::MockTableModelObserver observer(table_model_.get()); | 215 plugin_test_internal::MockTableModelObserver observer(table_model_.get()); |
212 table_model_->SetObserver(&observer); | 216 table_model_->SetObserver(&observer); |
213 | 217 |
214 EXPECT_CALL(observer, OnModelChanged()); | 218 EXPECT_CALL(observer, OnModelChanged()); |
215 table_model_->RemoveAll(); | 219 table_model_->RemoveAll(); |
216 EXPECT_EQ(0, table_model_->RowCount()); | 220 EXPECT_EQ(0, table_model_->RowCount()); |
217 EXPECT_EQ(0, static_cast<int>(table_model_->GetGroups().size())); | 221 EXPECT_EQ(0, static_cast<int>(table_model_->GetGroups().size())); |
218 CheckInvariants(); | 222 CheckInvariants(); |
219 table_model_->SetObserver(NULL); | 223 table_model_->SetObserver(NULL); |
220 } | 224 } |
OLD | NEW |