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

Side by Side Diff: chrome/browser/content_settings/content_settings_rule_unittest.cc

Issue 12212048: Linux/ChromeOS Chromium style checker cleanup, chrome/browser edition. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 10 months 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) 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 <list> 5 #include <list>
6 6
7 #include "chrome/common/content_settings_pattern.h" 7 #include "chrome/common/content_settings_pattern.h"
8 #include "chrome/browser/content_settings/content_settings_rule.h" 8 #include "chrome/browser/content_settings/content_settings_rule.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace content_settings { 11 namespace content_settings {
12 12
13 namespace { 13 namespace {
14 14
15 class ListIterator : public RuleIterator { 15 class ListIterator : public RuleIterator {
16 public: 16 public:
17 explicit ListIterator(const std::list<Rule>& rules) 17 explicit ListIterator(const std::list<Rule>& rules)
18 : rules_(rules) {} 18 : rules_(rules) {}
19 19
20 virtual ~ListIterator() {} 20 virtual ~ListIterator() {}
21 21
22 virtual bool HasNext() const { 22 virtual bool HasNext() const OVERRIDE {
23 return !rules_.empty(); 23 return !rules_.empty();
24 } 24 }
25 25
26 virtual Rule Next() { 26 virtual Rule Next() OVERRIDE {
27 EXPECT_FALSE(rules_.empty()); 27 EXPECT_FALSE(rules_.empty());
28 // |front()| returns a reference but we're going to discard the object 28 // |front()| returns a reference but we're going to discard the object
29 // referred to; force copying here. 29 // referred to; force copying here.
30 Rule rule = rules_.front(); 30 Rule rule = rules_.front();
31 rules_.pop_front(); 31 rules_.pop_front();
32 return rule; 32 return rule;
33 } 33 }
34 34
35 private: 35 private:
36 std::list<Rule> rules_; 36 std::list<Rule> rules_;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 EXPECT_EQ(rule.primary_pattern, ContentSettingsPattern::FromString("c")); 73 EXPECT_EQ(rule.primary_pattern, ContentSettingsPattern::FromString("c"));
74 74
75 ASSERT_TRUE(concatenation_iterator.HasNext()); 75 ASSERT_TRUE(concatenation_iterator.HasNext());
76 rule = concatenation_iterator.Next(); 76 rule = concatenation_iterator.Next();
77 EXPECT_EQ(rule.primary_pattern, ContentSettingsPattern::FromString("d")); 77 EXPECT_EQ(rule.primary_pattern, ContentSettingsPattern::FromString("d"));
78 78
79 EXPECT_FALSE(concatenation_iterator.HasNext()); 79 EXPECT_FALSE(concatenation_iterator.HasNext());
80 } 80 }
81 81
82 } // namespace content_settings 82 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698