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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 104 } |
103 | 105 |
104 void PPAPITestBase::InfoBarObserver::VerifyInfoBarState() { | 106 void PPAPITestBase::InfoBarObserver::VerifyInfoBarState() { |
105 content::WebContents* web_contents = | 107 content::WebContents* web_contents = |
106 test_base_->browser()->tab_strip_model()->GetActiveWebContents(); | 108 test_base_->browser()->tab_strip_model()->GetActiveWebContents(); |
107 ASSERT_TRUE(web_contents != NULL); | 109 ASSERT_TRUE(web_contents != NULL); |
108 InfoBarService* infobar_service = | 110 InfoBarService* infobar_service = |
109 InfoBarService::FromWebContents(web_contents); | 111 InfoBarService::FromWebContents(web_contents); |
110 ASSERT_TRUE(infobar_service != NULL); | 112 ASSERT_TRUE(infobar_service != NULL); |
111 | 113 |
112 EXPECT_EQ(expecting_infobar_ ? 1U : 0U, infobar_service->infobar_count()); | 114 InfoBarManager* infobar_manager = infobar_service->infobar_manager(); |
| 115 EXPECT_EQ(expecting_infobar_ ? 1U : 0U, infobar_manager->infobar_count()); |
113 if (!expecting_infobar_) | 116 if (!expecting_infobar_) |
114 return; | 117 return; |
115 expecting_infobar_ = false; | 118 expecting_infobar_ = false; |
116 | 119 |
117 InfoBar* infobar = infobar_service->infobar_at(0); | 120 InfoBar* infobar = infobar_manager->infobar_at(0); |
118 ConfirmInfoBarDelegate* delegate = | 121 ConfirmInfoBarDelegate* delegate = |
119 infobar->delegate()->AsConfirmInfoBarDelegate(); | 122 infobar->delegate()->AsConfirmInfoBarDelegate(); |
120 ASSERT_TRUE(delegate != NULL); | 123 ASSERT_TRUE(delegate != NULL); |
121 if (should_accept_) | 124 if (should_accept_) |
122 delegate->Accept(); | 125 delegate->Accept(); |
123 else | 126 else |
124 delegate->Cancel(); | 127 delegate->Cancel(); |
125 | 128 |
126 infobar_service->RemoveInfoBar(infobar); | 129 infobar_manager->RemoveInfoBar(infobar); |
127 } | 130 } |
128 | 131 |
129 PPAPITestBase::PPAPITestBase() { | 132 PPAPITestBase::PPAPITestBase() { |
130 } | 133 } |
131 | 134 |
132 void PPAPITestBase::SetUp() { | 135 void PPAPITestBase::SetUp() { |
133 EnablePixelOutput(); | 136 EnablePixelOutput(); |
134 InProcessBrowserTest::SetUp(); | 137 InProcessBrowserTest::SetUp(); |
135 } | 138 } |
136 | 139 |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 } | 469 } |
467 | 470 |
468 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { | 471 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { |
469 // The default content setting for the PPAPI broker is ASK. We purposefully | 472 // The default content setting for the PPAPI broker is ASK. We purposefully |
470 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. | 473 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. |
471 | 474 |
472 base::FilePath plugin_lib; | 475 base::FilePath plugin_lib; |
473 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); | 476 EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); |
474 EXPECT_TRUE(base::PathExists(plugin_lib)); | 477 EXPECT_TRUE(base::PathExists(plugin_lib)); |
475 } | 478 } |
OLD | NEW |