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

Side by Side Diff: third_party/WebKit/Source/core/dom/DocumentTest.cpp

Issue 2566523003: Fix meta-theme-color not working outside <head> (Closed)
Patch Set: Add tests Created 4 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014, Google Inc. All rights reserved. 2 * Copyright (c) 2014, 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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 EXPECT_EQ(observer.updatedCharacterDataRecords()[2]->m_newLength, 3u); 583 EXPECT_EQ(observer.updatedCharacterDataRecords()[2]->m_newLength, 3u);
584 584
585 replaceSample->replaceData(6, 4, "ghi", ASSERT_NO_EXCEPTION); 585 replaceSample->replaceData(6, 4, "ghi", ASSERT_NO_EXCEPTION);
586 ASSERT_EQ(observer.updatedCharacterDataRecords().size(), 4u); 586 ASSERT_EQ(observer.updatedCharacterDataRecords().size(), 4u);
587 EXPECT_EQ(observer.updatedCharacterDataRecords()[3]->m_node, replaceSample); 587 EXPECT_EQ(observer.updatedCharacterDataRecords()[3]->m_node, replaceSample);
588 EXPECT_EQ(observer.updatedCharacterDataRecords()[3]->m_offset, 6u); 588 EXPECT_EQ(observer.updatedCharacterDataRecords()[3]->m_offset, 6u);
589 EXPECT_EQ(observer.updatedCharacterDataRecords()[3]->m_oldLength, 4u); 589 EXPECT_EQ(observer.updatedCharacterDataRecords()[3]->m_oldLength, 4u);
590 EXPECT_EQ(observer.updatedCharacterDataRecords()[3]->m_newLength, 3u); 590 EXPECT_EQ(observer.updatedCharacterDataRecords()[3]->m_newLength, 3u);
591 } 591 }
592 592
593 // This tests that meta-theme-color can be found correctly
594 TEST_F(DocumentTest, ThemeColor) {
595 {
596 setHtmlInnerHTML(
597 "<meta name=\"theme-color\" content=\"#00ff00\">"
598 "<body>"
599 "Theme color should be bright green.");
600 auto themeColor = document().themeColor();
601 EXPECT_EQ(themeColor.red(), 0);
tkent 2016/12/09 08:48:38 The first argument should be an expected value. Al
lpy 2016/12/09 09:17:37 Done.
602 EXPECT_EQ(themeColor.green(), 255);
603 EXPECT_EQ(themeColor.blue(), 0);
604 }
605
606 {
607 setHtmlInnerHTML(
608 "<body>"
609 "<meta name=\"theme-color\" content=\"#00ff00\">"
610 "Theme color should be bright green.");
611 auto themeColor = document().themeColor();
612 EXPECT_EQ(themeColor.red(), 0);
613 EXPECT_EQ(themeColor.green(), 255);
614 EXPECT_EQ(themeColor.blue(), 0);
615 }
616 }
617
593 } // namespace blink 618 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698