| OLD | NEW |
| 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 "ui/message_center/views/notification_view.h" | 5 #include "ui/message_center/views/notification_view.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 virtual void ClickOnNotificationButton(const std::string& notification_id, | 47 virtual void ClickOnNotificationButton(const std::string& notification_id, |
| 48 int button_index) OVERRIDE; | 48 int button_index) OVERRIDE; |
| 49 | 49 |
| 50 protected: | 50 protected: |
| 51 const gfx::Image CreateTestImage(int width, int height) { | 51 const gfx::Image CreateTestImage(int width, int height) { |
| 52 return gfx::Image::CreateFrom1xBitmap(CreateBitmap(width, height)); | 52 return gfx::Image::CreateFrom1xBitmap(CreateBitmap(width, height)); |
| 53 } | 53 } |
| 54 | 54 |
| 55 const SkBitmap CreateBitmap(int width, int height) { | 55 const SkBitmap CreateBitmap(int width, int height) { |
| 56 SkBitmap bitmap; | 56 SkBitmap bitmap; |
| 57 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); | 57 bitmap.allocN32Pixels(width, height); |
| 58 bitmap.allocPixels(); | |
| 59 bitmap.eraseRGB(0, 255, 0); | 58 bitmap.eraseRGB(0, 255, 0); |
| 60 return bitmap; | 59 return bitmap; |
| 61 } | 60 } |
| 62 | 61 |
| 63 std::vector<ButtonInfo> CreateButtons(int number) { | 62 std::vector<ButtonInfo> CreateButtons(int number) { |
| 64 ButtonInfo info(base::ASCIIToUTF16("Test button title.")); | 63 ButtonInfo info(base::ASCIIToUTF16("Test button title.")); |
| 65 info.icon = CreateTestImage(4, 4); | 64 info.icon = CreateTestImage(4, 4); |
| 66 return std::vector<ButtonInfo>(number, info); | 65 return std::vector<ButtonInfo>(number, info); |
| 67 } | 66 } |
| 68 | 67 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 | 313 |
| 315 // Double-check that vertical order is correct. | 314 // Double-check that vertical order is correct. |
| 316 CheckVerticalOrderInNotification(); | 315 CheckVerticalOrderInNotification(); |
| 317 | 316 |
| 318 // Tests that views remain in that order even after an update. | 317 // Tests that views remain in that order even after an update. |
| 319 UpdateNotificationViews(); | 318 UpdateNotificationViews(); |
| 320 CheckVerticalOrderInNotification(); | 319 CheckVerticalOrderInNotification(); |
| 321 } | 320 } |
| 322 | 321 |
| 323 } // namespace message_center | 322 } // namespace message_center |
| OLD | NEW |