| 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 #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/testing_pref_service.h" | 10 #include "chrome/test/testing_pref_service.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 CONTENT_SETTINGS_TYPE_PLUGINS, | 81 CONTENT_SETTINGS_TYPE_PLUGINS, |
| 82 "b-bar", | 82 "b-bar", |
| 83 CONTENT_SETTING_ALLOW); | 83 CONTENT_SETTING_ALLOW); |
| 84 | 84 |
| 85 table_model_.reset(new MockPluginExceptionsTableModel(map, NULL)); | 85 table_model_.reset(new MockPluginExceptionsTableModel(map, NULL)); |
| 86 | 86 |
| 87 std::vector<webkit::npapi::PluginGroup> plugins; | 87 std::vector<webkit::npapi::PluginGroup> plugins; |
| 88 webkit::npapi::WebPluginInfo foo_plugin; | 88 webkit::npapi::WebPluginInfo foo_plugin; |
| 89 foo_plugin.path = FilePath(FILE_PATH_LITERAL("a-foo")); | 89 foo_plugin.path = FilePath(FILE_PATH_LITERAL("a-foo")); |
| 90 foo_plugin.name = ASCIIToUTF16("FooPlugin"); | 90 foo_plugin.name = ASCIIToUTF16("FooPlugin"); |
| 91 foo_plugin.enabled = true; | 91 foo_plugin.enabled = |
| 92 webkit::npapi::WebPluginInfo::USER_ENABLED_POLICY_UNMANAGED; |
| 92 scoped_ptr<webkit::npapi::PluginGroup> foo_group( | 93 scoped_ptr<webkit::npapi::PluginGroup> foo_group( |
| 93 webkit::npapi::PluginGroup::FromWebPluginInfo(foo_plugin)); | 94 webkit::npapi::PluginGroup::FromWebPluginInfo(foo_plugin)); |
| 94 plugins.push_back(*foo_group); | 95 plugins.push_back(*foo_group); |
| 95 | 96 |
| 96 webkit::npapi::WebPluginInfo bar_plugin; | 97 webkit::npapi::WebPluginInfo bar_plugin; |
| 97 bar_plugin.path = FilePath(FILE_PATH_LITERAL("b-bar")); | 98 bar_plugin.path = FilePath(FILE_PATH_LITERAL("b-bar")); |
| 98 bar_plugin.name = ASCIIToUTF16("BarPlugin"); | 99 bar_plugin.name = ASCIIToUTF16("BarPlugin"); |
| 99 bar_plugin.enabled = true; | 100 bar_plugin.enabled = |
| 101 webkit::npapi::WebPluginInfo::USER_ENABLED_POLICY_UNMANAGED; |
| 100 scoped_ptr<webkit::npapi::PluginGroup> bar_group( | 102 scoped_ptr<webkit::npapi::PluginGroup> bar_group( |
| 101 webkit::npapi::PluginGroup::FromWebPluginInfo(bar_plugin)); | 103 webkit::npapi::PluginGroup::FromWebPluginInfo(bar_plugin)); |
| 102 plugins.push_back(*bar_group); | 104 plugins.push_back(*bar_group); |
| 103 | 105 |
| 104 table_model_->set_plugins(plugins); | 106 table_model_->set_plugins(plugins); |
| 105 table_model_->ReloadSettings(); | 107 table_model_->ReloadSettings(); |
| 106 } | 108 } |
| 107 | 109 |
| 108 protected: | 110 protected: |
| 109 void CheckInvariants() { | 111 void CheckInvariants() { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 plugin_test_internal::MockTableModelObserver observer(table_model_.get()); | 209 plugin_test_internal::MockTableModelObserver observer(table_model_.get()); |
| 208 table_model_->SetObserver(&observer); | 210 table_model_->SetObserver(&observer); |
| 209 | 211 |
| 210 EXPECT_CALL(observer, OnModelChanged()); | 212 EXPECT_CALL(observer, OnModelChanged()); |
| 211 table_model_->RemoveAll(); | 213 table_model_->RemoveAll(); |
| 212 EXPECT_EQ(0, table_model_->RowCount()); | 214 EXPECT_EQ(0, table_model_->RowCount()); |
| 213 EXPECT_EQ(0, static_cast<int>(table_model_->GetGroups().size())); | 215 EXPECT_EQ(0, static_cast<int>(table_model_->GetGroups().size())); |
| 214 CheckInvariants(); | 216 CheckInvariants(); |
| 215 table_model_->SetObserver(NULL); | 217 table_model_->SetObserver(NULL); |
| 216 } | 218 } |
| OLD | NEW |