OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 5522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5533 SkCanvas canvas(bitmap); | 5533 SkCanvas canvas(bitmap); |
5534 canvas.drawColor(SK_ColorGREEN); | 5534 canvas.drawColor(SK_ColorGREEN); |
5535 | 5535 |
5536 EXPECT_EQ(20, dragImage->size().width()); | 5536 EXPECT_EQ(20, dragImage->size().width()); |
5537 EXPECT_EQ(40, dragImage->size().height()); | 5537 EXPECT_EQ(40, dragImage->size().height()); |
5538 const SkBitmap& dragBitmap = dragImage->bitmap(); | 5538 const SkBitmap& dragBitmap = dragImage->bitmap(); |
5539 SkAutoLockPixels lockPixel(dragBitmap); | 5539 SkAutoLockPixels lockPixel(dragBitmap); |
5540 EXPECT_EQ(0, memcmp(bitmap.getPixels(), dragBitmap.getPixels(), bitmap.getSi
ze())); | 5540 EXPECT_EQ(0, memcmp(bitmap.getPixels(), dragBitmap.getPixels(), bitmap.getSi
ze())); |
5541 } | 5541 } |
5542 | 5542 |
| 5543 class BrandColorTestWebFrameClient : public FrameTestHelpers::TestWebFrameClient
{ |
| 5544 public: |
| 5545 BrandColorTestWebFrameClient() |
| 5546 : m_didNotify(false) |
| 5547 , m_brandColor(0) |
| 5548 { |
| 5549 } |
| 5550 |
| 5551 bool didNotify() const |
| 5552 { |
| 5553 return m_didNotify; |
| 5554 } |
| 5555 |
| 5556 WebColor brandColor() const |
| 5557 { |
| 5558 return m_brandColor; |
| 5559 } |
| 5560 |
| 5561 private: |
| 5562 virtual void didChangeBrandColor(WebLocalFrame* webLocalFrame) |
| 5563 { |
| 5564 m_didNotify = true; |
| 5565 m_brandColor = webLocalFrame->document().brandColor(); |
| 5566 } |
| 5567 |
| 5568 bool m_didNotify; |
| 5569 WebColor m_brandColor; |
| 5570 }; |
| 5571 |
| 5572 TEST_F(WebFrameTest, BrandColor) |
| 5573 { |
| 5574 registerMockedHttpURLLoad("brand_color_test.html"); |
| 5575 FrameTestHelpers::WebViewHelper webViewHelper; |
| 5576 BrandColorTestWebFrameClient client; |
| 5577 WebCore::RuntimeEnabledFeatures::setBrandColorEnabled(true); |
| 5578 webViewHelper.initializeAndLoad(m_baseURL + "brand_color_test.html", false,
&client); |
| 5579 EXPECT_TRUE(client.didNotify()); |
| 5580 EXPECT_EQ(0xff0000ff, client.brandColor()); |
| 5581 } |
| 5582 |
5543 } // namespace | 5583 } // namespace |
OLD | NEW |