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

Side by Side Diff: ui/gfx/color_analysis_unittest.cc

Issue 667923002: Standardize usage of virtual/override/final in ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « ui/gfx/color_analysis.h ('k') | ui/gfx/display_change_notifier_unittest.cc » ('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 "ui/gfx/color_analysis.h" 5 #include "ui/gfx/color_analysis.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/skia/include/core/SkBitmap.h" 10 #include "third_party/skia/include/core/SkBitmap.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 class MockKMeanImageSampler : public KMeanImageSampler { 106 class MockKMeanImageSampler : public KMeanImageSampler {
107 public: 107 public:
108 MockKMeanImageSampler() : current_result_index_(0) { 108 MockKMeanImageSampler() : current_result_index_(0) {
109 } 109 }
110 110
111 explicit MockKMeanImageSampler(const std::vector<int>& samples) 111 explicit MockKMeanImageSampler(const std::vector<int>& samples)
112 : prebaked_sample_results_(samples), 112 : prebaked_sample_results_(samples),
113 current_result_index_(0) { 113 current_result_index_(0) {
114 } 114 }
115 115
116 virtual ~MockKMeanImageSampler() { 116 ~MockKMeanImageSampler() override {}
117 }
118 117
119 void AddSample(int sample) { 118 void AddSample(int sample) {
120 prebaked_sample_results_.push_back(sample); 119 prebaked_sample_results_.push_back(sample);
121 } 120 }
122 121
123 virtual int GetSample(int width, int height) override { 122 int GetSample(int width, int height) override {
124 if (current_result_index_ >= prebaked_sample_results_.size()) { 123 if (current_result_index_ >= prebaked_sample_results_.size()) {
125 current_result_index_ = 0; 124 current_result_index_ = 0;
126 } 125 }
127 126
128 if (prebaked_sample_results_.empty()) { 127 if (prebaked_sample_results_.empty()) {
129 return 0; 128 return 0;
130 } 129 }
131 130
132 return prebaked_sample_results_[current_result_index_++]; 131 return prebaked_sample_results_[current_result_index_++];
133 } 132 }
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 Calculate8bitBitmapMinMax(result, &min_gl, &max_gl); 495 Calculate8bitBitmapMinMax(result, &min_gl, &max_gl);
497 496
498 EXPECT_EQ(0, min_gl); 497 EXPECT_EQ(0, min_gl);
499 EXPECT_EQ(255, max_gl); 498 EXPECT_EQ(255, max_gl);
500 EXPECT_EQ(min_gl, SkColorGetA(result.getColor(0, 0))); 499 EXPECT_EQ(min_gl, SkColorGetA(result.getColor(0, 0)));
501 EXPECT_EQ(max_gl, SkColorGetA(result.getColor(299, 199))); 500 EXPECT_EQ(max_gl, SkColorGetA(result.getColor(299, 199)));
502 EXPECT_EQ(93U, SkColorGetA(result.getColor(150, 0))); 501 EXPECT_EQ(93U, SkColorGetA(result.getColor(150, 0)));
503 } 502 }
504 503
505 } // namespace color_utils 504 } // namespace color_utils
OLDNEW
« no previous file with comments | « ui/gfx/color_analysis.h ('k') | ui/gfx/display_change_notifier_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698