autofill_dialog_types_unittest.cc revision 5d1f7b1de12d16ceb2c938c56701a3e8bfa558f7
1// Copyright 2013 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#include "base/strings/utf_string_conversions.h" 6#include "chrome/browser/ui/autofill/autofill_dialog_types.h" 7#include "testing/gtest/include/gtest/gtest.h" 8 9#if defined(TOOLKIT_VIEWS) 10#include "ui/views/color_constants.h" 11#endif 12 13namespace autofill { 14 15#if defined(TOOLKIT_VIEWS) 16TEST(AutofillDialogTypesTest, WarningColorMatches) { 17 EXPECT_EQ(kWarningColor, views::kWarningColor); 18} 19#endif 20 21// Tests for correct parsing of anchor text ranges. 22TEST(AutofillDialogTypesTest, DialogNotificationLink) { 23 base::string16 text(base::ASCIIToUTF16("Notification without anchor text")); 24 DialogNotification notification(DialogNotification::WALLET_ERROR, text); 25 EXPECT_TRUE(notification.link_range().is_empty()); 26 27 text = base::ASCIIToUTF16("Notification with |anchor text|"); 28 notification = DialogNotification(DialogNotification::WALLET_ERROR, text); 29 base::char16 bar = '|'; 30 EXPECT_EQ(base::string16::npos, notification.display_text().find(bar)); 31 EXPECT_FALSE(notification.link_range().is_empty()); 32} 33 34} // namespace autofill 35