| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "core/dom/TreeScopeStyleSheetCollection.h" | 5 #include "core/dom/TreeScopeStyleSheetCollection.h" |
| 6 | 6 |
| 7 #include "core/css/CSSStyleSheet.h" | 7 #include "core/css/CSSStyleSheet.h" |
| 8 #include "core/css/StyleSheetContents.h" | 8 #include "core/css/StyleSheetContents.h" |
| 9 #include "core/css/parser/CSSParserMode.h" | 9 #include "core/css/parser/CSSParserMode.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 previous.append(sheet1); | 113 previous.append(sheet1); |
| 114 previous.append(sheet2); | 114 previous.append(sheet2); |
| 115 previous.append(sheet3); | 115 previous.append(sheet3); |
| 116 | 116 |
| 117 current.append(sheet1); | 117 current.append(sheet1); |
| 118 current.append(sheet3); | 118 current.append(sheet3); |
| 119 | 119 |
| 120 added.append(sheet2->contents()); | 120 added.append(sheet2->contents()); |
| 121 | 121 |
| 122 // This is really the same as Insert. TreeScopeStyleSheetCollection::compareSt
yleSheets | 122 // This is really the same as Insert. |
| 123 // will assert if you pass an array that is longer as the first parameter. | 123 // TreeScopeStyleSheetCollection::compareStyleSheets will assert if you pass |
| 124 // an array that is longer as the first parameter. |
| 124 compareStyleSheets(current, previous, added, Reconstruct); | 125 compareStyleSheets(current, previous, added, Reconstruct); |
| 125 } | 126 } |
| 126 | 127 |
| 127 TEST_F(TreeScopeStyleSheetCollectionTest, CompareStyleSheetsInsertRemove) { | 128 TEST_F(TreeScopeStyleSheetCollectionTest, CompareStyleSheetsInsertRemove) { |
| 128 CSSStyleSheet* sheet1 = createSheet(); | 129 CSSStyleSheet* sheet1 = createSheet(); |
| 129 CSSStyleSheet* sheet2 = createSheet(); | 130 CSSStyleSheet* sheet2 = createSheet(); |
| 130 CSSStyleSheet* sheet3 = createSheet(); | 131 CSSStyleSheet* sheet3 = createSheet(); |
| 131 | 132 |
| 132 ContentsVector added; | 133 ContentsVector added; |
| 133 SheetVector previous; | 134 SheetVector previous; |
| 134 SheetVector current; | 135 SheetVector current; |
| 135 | 136 |
| 136 previous.append(sheet1); | 137 previous.append(sheet1); |
| 137 previous.append(sheet2); | 138 previous.append(sheet2); |
| 138 | 139 |
| 139 current.append(sheet2); | 140 current.append(sheet2); |
| 140 current.append(sheet3); | 141 current.append(sheet3); |
| 141 | 142 |
| 142 // TODO(rune@opera.com): This is clearly wrong. We add sheet3 and remove sheet
1 and | 143 // TODO(rune@opera.com): This is clearly wrong. We add sheet3 and remove |
| 143 // compareStyleSheets returns sheet2 and sheet3 as added (crbug/475858). | 144 // sheet1 and compareStyleSheets returns sheet2 and sheet3 as added |
| 145 // (crbug/475858). |
| 144 added.append(sheet2->contents()); | 146 added.append(sheet2->contents()); |
| 145 added.append(sheet3->contents()); | 147 added.append(sheet3->contents()); |
| 146 | 148 |
| 147 compareStyleSheets(previous, current, added, Reconstruct); | 149 compareStyleSheets(previous, current, added, Reconstruct); |
| 148 } | 150 } |
| 149 | 151 |
| 150 } // namespace blink | 152 } // namespace blink |
| OLD | NEW |