Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: chrome/browser/ui/cocoa/table_model_array_controller_unittest.mm

Issue 5574001: Move ContentSettingsDetails and Pattern out of HostContentSettingsMap as separate classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/browser/content_settings
Patch Set: updates Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 17 matching lines...) Expand all
28 28
29 virtual void SetUp() { 29 virtual void SetUp() {
30 CocoaTest::SetUp(); 30 CocoaTest::SetUp();
31 31
32 CommandLine::ForCurrentProcess()->AppendSwitch( 32 CommandLine::ForCurrentProcess()->AppendSwitch(
33 switches::kEnableResourceContentSettings); 33 switches::kEnableResourceContentSettings);
34 34
35 TestingProfile* profile = browser_helper_.profile(); 35 TestingProfile* profile = browser_helper_.profile();
36 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); 36 HostContentSettingsMap* map = profile->GetHostContentSettingsMap();
37 37
38 HostContentSettingsMap::Pattern example_com("[*.]example.com"); 38 ContentSettingsPattern example_com("[*.]example.com");
39 HostContentSettingsMap::Pattern moose_org("[*.]moose.org"); 39 ContentSettingsPattern moose_org("[*.]moose.org");
40 map->SetContentSetting(example_com, 40 map->SetContentSetting(example_com,
41 CONTENT_SETTINGS_TYPE_PLUGINS, 41 CONTENT_SETTINGS_TYPE_PLUGINS,
42 "a-foo", 42 "a-foo",
43 CONTENT_SETTING_ALLOW); 43 CONTENT_SETTING_ALLOW);
44 map->SetContentSetting(moose_org, 44 map->SetContentSetting(moose_org,
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,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 131 }
132 132
133 TEST_F(TableModelArrayControllerTest, RemoveAll) { 133 TEST_F(TableModelArrayControllerTest, RemoveAll) {
134 [controller_.get() removeAll:nil]; 134 [controller_.get() removeAll:nil];
135 EXPECT_EQ(0u, [[controller_.get() arrangedObjects] count]); 135 EXPECT_EQ(0u, [[controller_.get() arrangedObjects] count]);
136 } 136 }
137 137
138 TEST_F(TableModelArrayControllerTest, AddException) { 138 TEST_F(TableModelArrayControllerTest, AddException) {
139 TestingProfile* profile = browser_helper_.profile(); 139 TestingProfile* profile = browser_helper_.profile();
140 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); 140 HostContentSettingsMap* map = profile->GetHostContentSettingsMap();
141 HostContentSettingsMap::Pattern example_com("[*.]example.com"); 141 ContentSettingsPattern example_com("[*.]example.com");
142 map->SetContentSetting(example_com, 142 map->SetContentSetting(example_com,
143 CONTENT_SETTINGS_TYPE_PLUGINS, 143 CONTENT_SETTINGS_TYPE_PLUGINS,
144 "c-blurp", 144 "c-blurp",
145 CONTENT_SETTING_BLOCK); 145 CONTENT_SETTING_BLOCK);
146 146
147 NSArrayController* controller = controller_.get(); 147 NSArrayController* controller = controller_.get();
148 NSArray* titles = [[controller arrangedObjects] valueForKey:@"title"]; 148 NSArray* titles = [[controller arrangedObjects] valueForKey:@"title"];
149 EXPECT_NSEQ(@"(\n" 149 EXPECT_NSEQ(@"(\n"
150 @" FooPlugin,\n" 150 @" FooPlugin,\n"
151 @" \"[*.]example.com\",\n" 151 @" \"[*.]example.com\",\n"
(...skipping 11 matching lines...) Expand all
163 titles = [[controller arrangedObjects] valueForKey:@"title"]; 163 titles = [[controller arrangedObjects] valueForKey:@"title"];
164 EXPECT_NSEQ(@"(\n" 164 EXPECT_NSEQ(@"(\n"
165 @" BarPlugin,\n" 165 @" BarPlugin,\n"
166 @" \"[*.]example.com\",\n" 166 @" \"[*.]example.com\",\n"
167 @" \"[*.]moose.org\"\n" 167 @" \"[*.]moose.org\"\n"
168 @")", 168 @")",
169 [titles description]); 169 [titles description]);
170 } 170 }
171 171
172 } // namespace 172 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698