OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/test/ppapi/ppapi_test.h" | 5 #include "chrome/test/ppapi/ppapi_test.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
13 #include "chrome/browser/content_settings/host_content_settings_map.h" | 13 #include "chrome/browser/content_settings/host_content_settings_map.h" |
14 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 14 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
15 #include "chrome/browser/infobars/infobar.h" | 15 #include "chrome/browser/infobars/infobar.h" |
| 16 #include "chrome/browser/infobars/infobar_manager.h" |
| 17 #include "chrome/browser/infobars/infobar_service.h" |
16 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
19 #include "chrome/common/chrome_paths.h" | 21 #include "chrome/common/chrome_paths.h" |
20 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/test/base/test_switches.h" | 23 #include "chrome/test/base/test_switches.h" |
22 #include "chrome/test/base/ui_test_utils.h" | 24 #include "chrome/test/base/ui_test_utils.h" |
23 #include "content/public/browser/dom_operation_notification_details.h" | 25 #include "content/public/browser/dom_operation_notification_details.h" |
24 #include "content/public/browser/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
25 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 base::Unretained(this))); | 111 base::Unretained(this))); |
110 } | 112 } |
111 | 113 |
112 void PPAPITestBase::InfoBarObserver::VerifyInfoBarState() { | 114 void PPAPITestBase::InfoBarObserver::VerifyInfoBarState() { |
113 content::WebContents* web_contents = | 115 content::WebContents* web_contents = |
114 test_base_->browser()->tab_strip_model()->GetActiveWebContents(); | 116 test_base_->browser()->tab_strip_model()->GetActiveWebContents(); |
115 ASSERT_TRUE(web_contents != NULL); | 117 ASSERT_TRUE(web_contents != NULL); |
116 InfoBarService* infobar_service = | 118 InfoBarService* infobar_service = |
117 InfoBarService::FromWebContents(web_contents); | 119 InfoBarService::FromWebContents(web_contents); |
118 ASSERT_TRUE(infobar_service != NULL); | 120 ASSERT_TRUE(infobar_service != NULL); |
| 121 InfoBarManager& infobar_manager = infobar_service->infobar_manager(); |
119 | 122 |
120 EXPECT_EQ(expecting_infobar_ ? 1U : 0U, infobar_service->infobar_count()); | 123 EXPECT_EQ(expecting_infobar_ ? 1U : 0U, infobar_manager.infobar_count()); |
121 if (!expecting_infobar_) | 124 if (!expecting_infobar_) |
122 return; | 125 return; |
123 expecting_infobar_ = false; | 126 expecting_infobar_ = false; |
124 | 127 |
125 InfoBar* infobar = infobar_service->infobar_at(0); | 128 InfoBar* infobar = infobar_manager.infobar_at(0); |
126 ConfirmInfoBarDelegate* delegate = | 129 ConfirmInfoBarDelegate* delegate = |
127 infobar->delegate()->AsConfirmInfoBarDelegate(); | 130 infobar->delegate()->AsConfirmInfoBarDelegate(); |
128 ASSERT_TRUE(delegate != NULL); | 131 ASSERT_TRUE(delegate != NULL); |
129 if (should_accept_) | 132 if (should_accept_) |
130 delegate->Accept(); | 133 delegate->Accept(); |
131 else | 134 else |
132 delegate->Cancel(); | 135 delegate->Cancel(); |
133 | 136 |
134 infobar_service->RemoveInfoBar(infobar); | 137 infobar_manager.RemoveInfoBar(infobar); |
135 } | 138 } |
136 | 139 |
137 PPAPITestBase::PPAPITestBase() { | 140 PPAPITestBase::PPAPITestBase() { |
138 } | 141 } |
139 | 142 |
140 void PPAPITestBase::SetUp() { | 143 void PPAPITestBase::SetUp() { |
141 EnablePixelOutput(); | 144 EnablePixelOutput(); |
142 InProcessBrowserTest::SetUp(); | 145 InProcessBrowserTest::SetUp(); |
143 } | 146 } |
144 | 147 |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 const std::string& base, | 462 const std::string& base, |
460 const std::string& test_case) { | 463 const std::string& test_case) { |
461 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), | 464 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), |
462 test_case.c_str()); | 465 test_case.c_str()); |
463 } | 466 } |
464 | 467 |
465 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { | 468 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { |
466 // The default content setting for the PPAPI broker is ASK. We purposefully | 469 // The default content setting for the PPAPI broker is ASK. We purposefully |
467 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. | 470 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. |
468 } | 471 } |
OLD | NEW |