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

Side by Side Diff: chrome/renderer/extensions/utils_unittest.cc

Issue 332233002: enterprise.platformKeys: Copy-on-read the 'algorithm' member of Key objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ensure that crx is up-to-date. Created 6 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/strings/stringprintf.h" 5 #include "base/strings/stringprintf.h"
6 #include "chrome/test/base/module_system_test.h" 6 #include "chrome/test/base/module_system_test.h"
7 #include "grit/extensions_renderer_resources.h" 7 #include "grit/extensions_renderer_resources.h"
8 8
9 namespace extensions { 9 namespace extensions {
10 namespace { 10 namespace {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 "AssertTrue(subsub.superFunc() == 'superFunc');\n" 112 "AssertTrue(subsub.superFunc() == 'superFunc');\n"
113 "AssertTrue(subsub.subFunc() == 'subFunc');\n" 113 "AssertTrue(subsub.subFunc() == 'subFunc');\n"
114 "AssertTrue(subsub.subSubFunc() == 'subsub');\n" 114 "AssertTrue(subsub.subSubFunc() == 'subsub');\n"
115 "AssertTrue(subsub instanceof SuperClass);\n" 115 "AssertTrue(subsub instanceof SuperClass);\n"
116 "AssertTrue(subsub instanceof SubClass);\n" 116 "AssertTrue(subsub instanceof SubClass);\n"
117 "AssertTrue(subsub instanceof SubSubClass);\n"); 117 "AssertTrue(subsub instanceof SubSubClass);\n");
118 118
119 context_->module_system()->Require("test"); 119 context_->module_system()->Require("test");
120 } 120 }
121 121
122 TEST_F(UtilsUnittest, DeepCopy) {
123 ModuleSystem::NativesEnabledScope natives_enabled_scope(
124 context_->module_system());
125 RegisterTestModule(
126 "var nested = {\n"
127 " string: 'abc',\n"
128 " _null: null\n"
129 "};\n"
130 "var top = {\n"
131 " array: [1, 'abc', nested],\n"
132 " uint8array: new Uint8Array([1,2,3])\n"
133 "};\n"
134 "\n"
135 "var copy = utils.deepCopy(top);\n"
136 "// Ensure that the copy is not referencing to the original.\n"
137 "AssertTrue(copy !== top);\n"
138 "AssertTrue(copy.array !== top.array);\n"
139 "AssertTrue(copy.array[2] !== top.array[2]);\n"
140 "AssertTrue(copy.uint8array !== top.uint8array);\n"
141 "AssertTrue(copy.uint8array.buffer !== top.uint8array.buffer);\n"
142 "\n"
143 "// Check |copy|.\n"
144 "AssertTrue(Object.keys(copy) == 'array,uint8array');\n"
145 "\n"
146 "// Check |copy.array|.\n"
147 "AssertTrue(Array.isArray(copy.array));\n"
148 "AssertTrue(copy.array.length === 3);\n"
149 "AssertTrue(copy.array[0] === 1);\n"
150 "AssertTrue(copy.array[1] === 'abc');\n"
151 "\n"
152 "// Check |copy.array[2]|.\n"
153 "var copyNested = copy.array[2];\n"
154 "AssertTrue(Object.keys(copyNested) == 'string,_null');\n"
155 "AssertTrue(copyNested.string === 'abc');\n"
156 "AssertTrue(copyNested._null === null);\n");
157
158 context_->module_system()->Require("test");
159 }
160
122 } // namespace 161 } // namespace
123 } // namespace extensions 162 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698