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 5526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5537 SkCanvas canvas(bitmap); | 5537 SkCanvas canvas(bitmap); |
5538 canvas.drawColor(SK_ColorGREEN); | 5538 canvas.drawColor(SK_ColorGREEN); |
5539 | 5539 |
5540 EXPECT_EQ(20, dragImage->size().width()); | 5540 EXPECT_EQ(20, dragImage->size().width()); |
5541 EXPECT_EQ(40, dragImage->size().height()); | 5541 EXPECT_EQ(40, dragImage->size().height()); |
5542 const SkBitmap& dragBitmap = dragImage->bitmap(); | 5542 const SkBitmap& dragBitmap = dragImage->bitmap(); |
5543 SkAutoLockPixels lockPixel(dragBitmap); | 5543 SkAutoLockPixels lockPixel(dragBitmap); |
5544 EXPECT_EQ(0, memcmp(bitmap.getPixels(), dragBitmap.getPixels(), bitmap.getSi
ze())); | 5544 EXPECT_EQ(0, memcmp(bitmap.getPixels(), dragBitmap.getPixels(), bitmap.getSi
ze())); |
5545 } | 5545 } |
5546 | 5546 |
| 5547 class BrandColorTestWebFrameClient : public FrameTestHelpers::TestWebFrameClient
{ |
| 5548 public: |
| 5549 BrandColorTestWebFrameClient() |
| 5550 : m_didNotify(false) |
| 5551 , m_brandColor(0) |
| 5552 { |
| 5553 } |
| 5554 |
| 5555 bool didNotify() const |
| 5556 { |
| 5557 return m_didNotify; |
| 5558 } |
| 5559 |
| 5560 WebColor brandColor() const |
| 5561 { |
| 5562 return m_brandColor; |
| 5563 } |
| 5564 |
| 5565 private: |
| 5566 virtual void didChangeBrandColor(WebLocalFrame* webLocalFrame) |
| 5567 { |
| 5568 m_didNotify = true; |
| 5569 m_brandColor = webLocalFrame->document().brandColor(); |
| 5570 } |
| 5571 |
| 5572 bool m_didNotify; |
| 5573 WebColor m_brandColor; |
| 5574 }; |
| 5575 |
| 5576 TEST_F(WebFrameTest, BrandColor) |
| 5577 { |
| 5578 registerMockedHttpURLLoad("brand_color_test.html"); |
| 5579 FrameTestHelpers::WebViewHelper webViewHelper; |
| 5580 BrandColorTestWebFrameClient client; |
| 5581 webViewHelper.initializeAndLoad(m_baseURL + "brand_color_test.html", false,
&client); |
| 5582 EXPECT_TRUE(client.didNotify()); |
| 5583 EXPECT_EQ(0xff0000ff, client.brandColor()); |
| 5584 } |
| 5585 |
5547 } // namespace | 5586 } // namespace |
OLD | NEW |