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

Side by Side Diff: ui/base/x/x11_util_unittest.cc

Issue 11878022: ui: Convert scoped_arrays to the new scoped_ptr style. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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
« no previous file with comments | « ui/base/x/x11_util.cc ('k') | ui/gl/gl_surface_osmesa.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/base/x/x11_util.h" 8 #include "ui/base/x/x11_util.h"
9 9
10 namespace ui { 10 namespace ui {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 arraysize(kOverscanDisplay)); 145 arraysize(kOverscanDisplay));
146 display_data[150] = '\0'; 146 display_data[150] = '\0';
147 EXPECT_TRUE(ParseOutputOverscanFlag( 147 EXPECT_TRUE(ParseOutputOverscanFlag(
148 reinterpret_cast<const unsigned char*>(display_data.data()), 148 reinterpret_cast<const unsigned char*>(display_data.data()),
149 display_data.size(), &flag)); 149 display_data.size(), &flag));
150 EXPECT_FALSE(flag); 150 EXPECT_FALSE(flag);
151 } 151 }
152 152
153 TEST(X11UtilTest, ParseBrokenOverscanData) { 153 TEST(X11UtilTest, ParseBrokenOverscanData) {
154 // Do not fill valid data here because it anyway fails to parse the data. 154 // Do not fill valid data here because it anyway fails to parse the data.
155 scoped_array<unsigned char> data(new unsigned char[126]); 155 scoped_ptr<unsigned char[]> data(new unsigned char[126]);
156 bool flag = false; 156 bool flag = false;
157 EXPECT_FALSE(ParseOutputOverscanFlag(data.get(), 0, &flag)); 157 EXPECT_FALSE(ParseOutputOverscanFlag(data.get(), 0, &flag));
158 EXPECT_FALSE(ParseOutputOverscanFlag(data.get(), 126, &flag)); 158 EXPECT_FALSE(ParseOutputOverscanFlag(data.get(), 126, &flag));
159 159
160 // extending data because ParseOutputOverscanFlag() will access the data. 160 // extending data because ParseOutputOverscanFlag() will access the data.
161 data.reset(new unsigned char[150]); 161 data.reset(new unsigned char[150]);
162 // The number of CEA extensions is stored at byte 126. 162 // The number of CEA extensions is stored at byte 126.
163 data[126] = '\x01'; 163 data[126] = '\x01';
164 EXPECT_FALSE(ParseOutputOverscanFlag(data.get(), 128, &flag)); 164 EXPECT_FALSE(ParseOutputOverscanFlag(data.get(), 128, &flag));
165 EXPECT_FALSE(ParseOutputOverscanFlag(data.get(), 150, &flag)); 165 EXPECT_FALSE(ParseOutputOverscanFlag(data.get(), 150, &flag));
166 } 166 }
167 167
168 } 168 }
OLDNEW
« no previous file with comments | « ui/base/x/x11_util.cc ('k') | ui/gl/gl_surface_osmesa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698