| 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 "app/table_model_observer.h" | 5 #include "app/table_model_observer.h" |
| 6 #include "base/auto_reset.h" | 6 #include "base/auto_reset.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/mock_plugin_exceptions_table_model.h" | 9 #include "chrome/browser/mock_plugin_exceptions_table_model.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 *CommandLine::ForCurrentProcess()) {} | 58 *CommandLine::ForCurrentProcess()) {} |
| 59 | 59 |
| 60 virtual void SetUp() { | 60 virtual void SetUp() { |
| 61 CommandLine::ForCurrentProcess()->AppendSwitch( | 61 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 62 switches::kEnableResourceContentSettings); | 62 switches::kEnableResourceContentSettings); |
| 63 | 63 |
| 64 profile_.reset(new TestingProfile()); | 64 profile_.reset(new TestingProfile()); |
| 65 | 65 |
| 66 HostContentSettingsMap* map = profile_->GetHostContentSettingsMap(); | 66 HostContentSettingsMap* map = profile_->GetHostContentSettingsMap(); |
| 67 | 67 |
| 68 HostContentSettingsMap::Pattern example_com("[*.]example.com"); | 68 ContentSettingsPattern example_com("[*.]example.com"); |
| 69 HostContentSettingsMap::Pattern moose_org("[*.]moose.org"); | 69 ContentSettingsPattern moose_org("[*.]moose.org"); |
| 70 map->SetContentSetting(example_com, | 70 map->SetContentSetting(example_com, |
| 71 CONTENT_SETTINGS_TYPE_PLUGINS, | 71 CONTENT_SETTINGS_TYPE_PLUGINS, |
| 72 "a-foo", | 72 "a-foo", |
| 73 CONTENT_SETTING_ALLOW); | 73 CONTENT_SETTING_ALLOW); |
| 74 map->SetContentSetting(moose_org, | 74 map->SetContentSetting(moose_org, |
| 75 CONTENT_SETTINGS_TYPE_PLUGINS, | 75 CONTENT_SETTINGS_TYPE_PLUGINS, |
| 76 "b-bar", | 76 "b-bar", |
| 77 CONTENT_SETTING_BLOCK); | 77 CONTENT_SETTING_BLOCK); |
| 78 map->SetContentSetting(example_com, | 78 map->SetContentSetting(example_com, |
| 79 CONTENT_SETTINGS_TYPE_PLUGINS, | 79 CONTENT_SETTINGS_TYPE_PLUGINS, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 EXPECT_CALL(observer, OnModelChanged()); | 172 EXPECT_CALL(observer, OnModelChanged()); |
| 173 RemoveRowsTableModel::Rows rows; | 173 RemoveRowsTableModel::Rows rows; |
| 174 rows.insert(0); | 174 rows.insert(0); |
| 175 table_model_->RemoveRows(rows); | 175 table_model_->RemoveRows(rows); |
| 176 EXPECT_EQ(2, table_model_->RowCount()); | 176 EXPECT_EQ(2, table_model_->RowCount()); |
| 177 EXPECT_EQ(1, static_cast<int>(table_model_->GetGroups().size())); | 177 EXPECT_EQ(1, static_cast<int>(table_model_->GetGroups().size())); |
| 178 CheckInvariants(); | 178 CheckInvariants(); |
| 179 | 179 |
| 180 HostContentSettingsMap* map = profile_->GetHostContentSettingsMap(); | 180 HostContentSettingsMap* map = profile_->GetHostContentSettingsMap(); |
| 181 EXPECT_CALL(observer, OnModelChanged()); | 181 EXPECT_CALL(observer, OnModelChanged()); |
| 182 map->SetContentSetting(HostContentSettingsMap::Pattern("[*.]blurp.net"), | 182 map->SetContentSetting(ContentSettingsPattern("[*.]blurp.net"), |
| 183 CONTENT_SETTINGS_TYPE_PLUGINS, | 183 CONTENT_SETTINGS_TYPE_PLUGINS, |
| 184 "b-bar", | 184 "b-bar", |
| 185 CONTENT_SETTING_BLOCK); | 185 CONTENT_SETTING_BLOCK); |
| 186 EXPECT_EQ(3, table_model_->RowCount()); | 186 EXPECT_EQ(3, table_model_->RowCount()); |
| 187 | 187 |
| 188 InSequence s; | 188 InSequence s; |
| 189 EXPECT_CALL(observer, OnItemsRemoved(2, 1)); | 189 EXPECT_CALL(observer, OnItemsRemoved(2, 1)); |
| 190 EXPECT_CALL(observer, OnItemsRemoved(0, 1)); | 190 EXPECT_CALL(observer, OnItemsRemoved(0, 1)); |
| 191 rows.clear(); | 191 rows.clear(); |
| 192 rows.insert(0); | 192 rows.insert(0); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 205 | 205 |
| 206 EXPECT_CALL(observer, OnModelChanged()); | 206 EXPECT_CALL(observer, OnModelChanged()); |
| 207 table_model_->RemoveAll(); | 207 table_model_->RemoveAll(); |
| 208 EXPECT_EQ(0, table_model_->RowCount()); | 208 EXPECT_EQ(0, table_model_->RowCount()); |
| 209 EXPECT_EQ(0, static_cast<int>(table_model_->GetGroups().size())); | 209 EXPECT_EQ(0, static_cast<int>(table_model_->GetGroups().size())); |
| 210 CheckInvariants(); | 210 CheckInvariants(); |
| 211 table_model_->SetObserver(NULL); | 211 table_model_->SetObserver(NULL); |
| 212 } | 212 } |
| 213 | 213 |
| 214 } // namespace plugin_test_internal | 214 } // namespace plugin_test_internal |
| OLD | NEW |