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

Side by Side Diff: chrome/browser/ui/content_settings/content_setting_changed_infobar_delegate_unittest.cc

Issue 15067008: [InfoBar] Add InfoBarDelegate::GetIconID() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit fixes redux Created 7 years, 7 months 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 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 6 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
7 #include "chrome/browser/infobars/infobar_service.h" 7 #include "chrome/browser/infobars/infobar_service.h"
8 #include "chrome/browser/ui/content_settings/content_setting_changed_infobar_del egate.h" 8 #include "chrome/browser/ui/content_settings/content_setting_changed_infobar_del egate.h"
9 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 9 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
10 #include "content/public/browser/web_contents_observer.h" 10 #include "content/public/browser/web_contents_observer.h"
11 #include "content/public/test/web_contents_tester.h" 11 #include "content/public/test/web_contents_tester.h"
12 #include "grit/generated_resources.h" 12 #include "grit/generated_resources.h"
13 #include "grit/theme_resources.h" 13 #include "grit/theme_resources.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/base/resource/resource_bundle.h"
17 16
18 class ContentSettingChangedInfoBarDelegateTest : 17 class ContentSettingChangedInfoBarDelegateTest :
19 public ChromeRenderViewHostTestHarness { 18 public ChromeRenderViewHostTestHarness {
20 public: 19 public:
21 ContentSettingChangedInfoBarDelegateTest() { 20 ContentSettingChangedInfoBarDelegateTest() {
22 } 21 }
23 22
24 virtual ~ContentSettingChangedInfoBarDelegateTest() { 23 virtual ~ContentSettingChangedInfoBarDelegateTest() {
25 } 24 }
26 25
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 const int icon = IDR_INFOBAR_MEDIA_STREAM_CAMERA; 62 const int icon = IDR_INFOBAR_MEDIA_STREAM_CAMERA;
64 const int message = IDS_MEDIASTREAM_SETTING_CHANGED_INFOBAR_MESSAGE; 63 const int message = IDS_MEDIASTREAM_SETTING_CHANGED_INFOBAR_MESSAGE;
65 64
66 scoped_ptr<ContentSettingChangedInfoBarDelegate> infobar( 65 scoped_ptr<ContentSettingChangedInfoBarDelegate> infobar(
67 ContentSettingChangedInfoBarDelegate::CreateForUnitTest( 66 ContentSettingChangedInfoBarDelegate::CreateForUnitTest(
68 InfoBarService::FromWebContents(web_contents()), 67 InfoBarService::FromWebContents(web_contents()),
69 icon, 68 icon,
70 message)); 69 message));
71 ConfirmInfoBarDelegate* c_infobar = infobar.get(); 70 ConfirmInfoBarDelegate* c_infobar = infobar.get();
72 71
73 EXPECT_EQ(&ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon), 72 EXPECT_EQ(icon, c_infobar->GetIconID());
74 c_infobar->GetIcon());
75 EXPECT_FALSE(c_infobar->GetMessageText().compare( 73 EXPECT_FALSE(c_infobar->GetMessageText().compare(
76 l10n_util::GetStringUTF16(message))); 74 l10n_util::GetStringUTF16(message)));
77 75
78 EXPECT_EQ(1, observer.navigation_count()); 76 EXPECT_EQ(1, observer.navigation_count());
79 EXPECT_TRUE(c_infobar->Accept()); 77 EXPECT_TRUE(c_infobar->Accept());
80 EXPECT_EQ(2, observer.navigation_count()); 78 EXPECT_EQ(2, observer.navigation_count());
81 } 79 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698