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; | |
98 scoped_ptr<webkit::npapi::PluginGroup> foo_group( | 96 scoped_ptr<webkit::npapi::PluginGroup> foo_group( |
99 webkit::npapi::PluginGroup::FromWebPluginInfo(foo_plugin)); | 97 webkit::npapi::PluginGroup::FromWebPluginInfo(foo_plugin)); |
100 plugins.push_back(*foo_group); | 98 plugins.push_back(*foo_group); |
101 | 99 |
102 webkit::WebPluginInfo bar_plugin; | 100 webkit::WebPluginInfo bar_plugin; |
103 bar_plugin.path = FilePath(FILE_PATH_LITERAL("b-bar")); | 101 bar_plugin.path = FilePath(FILE_PATH_LITERAL("b-bar")); |
104 bar_plugin.name = ASCIIToUTF16("BarPlugin"); | 102 bar_plugin.name = ASCIIToUTF16("BarPlugin"); |
105 bar_plugin.enabled = | |
106 webkit::WebPluginInfo::USER_ENABLED_POLICY_UNMANAGED; | |
107 scoped_ptr<webkit::npapi::PluginGroup> bar_group( | 103 scoped_ptr<webkit::npapi::PluginGroup> bar_group( |
108 webkit::npapi::PluginGroup::FromWebPluginInfo(bar_plugin)); | 104 webkit::npapi::PluginGroup::FromWebPluginInfo(bar_plugin)); |
109 plugins.push_back(*bar_group); | 105 plugins.push_back(*bar_group); |
110 | 106 |
111 table_model_->set_plugins(plugins); | 107 table_model_->set_plugins(plugins); |
112 table_model_->ReloadSettings(); | 108 table_model_->ReloadSettings(); |
113 } | 109 } |
114 | 110 |
115 protected: | 111 protected: |
116 void CheckInvariants() const { | 112 void CheckInvariants() const { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 plugin_test_internal::MockTableModelObserver observer(table_model_.get()); | 211 plugin_test_internal::MockTableModelObserver observer(table_model_.get()); |
216 table_model_->SetObserver(&observer); | 212 table_model_->SetObserver(&observer); |
217 | 213 |
218 EXPECT_CALL(observer, OnModelChanged()); | 214 EXPECT_CALL(observer, OnModelChanged()); |
219 table_model_->RemoveAll(); | 215 table_model_->RemoveAll(); |
220 EXPECT_EQ(0, table_model_->RowCount()); | 216 EXPECT_EQ(0, table_model_->RowCount()); |
221 EXPECT_EQ(0, static_cast<int>(table_model_->GetGroups().size())); | 217 EXPECT_EQ(0, static_cast<int>(table_model_->GetGroups().size())); |
222 CheckInvariants(); | 218 CheckInvariants(); |
223 table_model_->SetObserver(NULL); | 219 table_model_->SetObserver(NULL); |
224 } | 220 } |
OLD | NEW |