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 #import "chrome/browser/ui/cocoa/table_model_array_controller.h" | 5 #import "chrome/browser/ui/cocoa/table_model_array_controller.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/mock_plugin_exceptions_table_model.h" | 10 #include "chrome/browser/mock_plugin_exceptions_table_model.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 CONTENT_SETTINGS_TYPE_PLUGINS, | 45 CONTENT_SETTINGS_TYPE_PLUGINS, |
46 "b-bar", | 46 "b-bar", |
47 CONTENT_SETTING_BLOCK); | 47 CONTENT_SETTING_BLOCK); |
48 map->SetContentSetting(example_com, | 48 map->SetContentSetting(example_com, |
49 CONTENT_SETTINGS_TYPE_PLUGINS, | 49 CONTENT_SETTINGS_TYPE_PLUGINS, |
50 "b-bar", | 50 "b-bar", |
51 CONTENT_SETTING_ALLOW); | 51 CONTENT_SETTING_ALLOW); |
52 | 52 |
53 model_.reset(new MockPluginExceptionsTableModel(map, NULL)); | 53 model_.reset(new MockPluginExceptionsTableModel(map, NULL)); |
54 | 54 |
55 NPAPI::PluginList::PluginMap plugins; | 55 std::vector<PluginGroup> plugins; |
56 WebPluginInfo foo_plugin; | 56 WebPluginInfo foo_plugin; |
57 foo_plugin.path = FilePath(FILE_PATH_LITERAL("a-foo")); | 57 foo_plugin.path = FilePath(FILE_PATH_LITERAL("a-foo")); |
58 foo_plugin.name = ASCIIToUTF16("FooPlugin"); | 58 foo_plugin.name = ASCIIToUTF16("FooPlugin"); |
59 foo_plugin.enabled = true; | 59 foo_plugin.enabled = true; |
60 PluginGroup* foo_group = PluginGroup::FromWebPluginInfo(foo_plugin); | 60 scoped_ptr<PluginGroup> foo_group( |
61 plugins[foo_group->identifier()] = linked_ptr<PluginGroup>(foo_group); | 61 PluginGroup::FromWebPluginInfo(foo_plugin)); |
| 62 plugins.push_back(*foo_group); |
62 WebPluginInfo bar_plugin; | 63 WebPluginInfo bar_plugin; |
63 bar_plugin.path = FilePath(FILE_PATH_LITERAL("b-bar")); | 64 bar_plugin.path = FilePath(FILE_PATH_LITERAL("b-bar")); |
64 bar_plugin.name = ASCIIToUTF16("BarPlugin"); | 65 bar_plugin.name = ASCIIToUTF16("BarPlugin"); |
65 bar_plugin.enabled = true; | 66 bar_plugin.enabled = true; |
66 PluginGroup* bar_group = PluginGroup::FromWebPluginInfo(bar_plugin); | 67 scope_ptr<PluginGroup> bar_group( |
67 plugins[bar_group->identifier()] = linked_ptr<PluginGroup>(bar_group); | 68 PluginGroup::FromWebPluginInfo(bar_plugin)); |
| 69 plugins.push_back(*bar_group); |
68 WebPluginInfo blurp_plugin; | 70 WebPluginInfo blurp_plugin; |
69 blurp_plugin.path = FilePath(FILE_PATH_LITERAL("c-blurp")); | 71 blurp_plugin.path = FilePath(FILE_PATH_LITERAL("c-blurp")); |
70 blurp_plugin.name = ASCIIToUTF16("BlurpPlugin"); | 72 blurp_plugin.name = ASCIIToUTF16("BlurpPlugin"); |
71 blurp_plugin.enabled = true; | 73 blurp_plugin.enabled = true; |
72 PluginGroup* blurp_group = PluginGroup::FromWebPluginInfo(blurp_plugin); | 74 scoped_ptr<PluginGroup> blurp_group( |
73 plugins[blurp_group->identifier()] = linked_ptr<PluginGroup>(blurp_group); | 75 PluginGroup::FromWebPluginInfo(blurp_plugin)); |
| 76 plugins.push_back(*blurp_group); |
74 | 77 |
75 model_->set_plugins(plugins); | 78 model_->set_plugins(plugins); |
76 model_->LoadSettings(); | 79 model_->LoadSettings(); |
77 | 80 |
78 id content = [NSMutableArray array]; | 81 id content = [NSMutableArray array]; |
79 controller_.reset( | 82 controller_.reset( |
80 [[TableModelArrayController alloc] initWithContent:content]); | 83 [[TableModelArrayController alloc] initWithContent:content]); |
81 NSDictionary* columns = [NSDictionary dictionaryWithObjectsAndKeys: | 84 NSDictionary* columns = [NSDictionary dictionaryWithObjectsAndKeys: |
82 [NSNumber numberWithInt:IDS_EXCEPTIONS_HOSTNAME_HEADER], @"title", | 85 [NSNumber numberWithInt:IDS_EXCEPTIONS_HOSTNAME_HEADER], @"title", |
83 [NSNumber numberWithInt:IDS_EXCEPTIONS_ACTION_HEADER], @"action", | 86 [NSNumber numberWithInt:IDS_EXCEPTIONS_ACTION_HEADER], @"action", |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 titles = [[controller arrangedObjects] valueForKey:@"title"]; | 166 titles = [[controller arrangedObjects] valueForKey:@"title"]; |
164 EXPECT_NSEQ(@"(\n" | 167 EXPECT_NSEQ(@"(\n" |
165 @" BarPlugin,\n" | 168 @" BarPlugin,\n" |
166 @" \"[*.]example.com\",\n" | 169 @" \"[*.]example.com\",\n" |
167 @" \"[*.]moose.org\"\n" | 170 @" \"[*.]moose.org\"\n" |
168 @")", | 171 @")", |
169 [titles description]); | 172 [titles description]); |
170 } | 173 } |
171 | 174 |
172 } // namespace | 175 } // namespace |
OLD | NEW |