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/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/location.h" |
9 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
11 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/thread_task_runner_handle.h" |
12 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
13 #include "chrome/browser/infobars/infobar_service.h" | 16 #include "chrome/browser/infobars/infobar_service.h" |
14 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
17 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
18 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/test/base/test_switches.h" | 22 #include "chrome/test/base/test_switches.h" |
20 #include "chrome/test/base/ui_test_utils.h" | 23 #include "chrome/test/base/ui_test_utils.h" |
21 #include "components/content_settings/core/browser/host_content_settings_map.h" | 24 #include "components/content_settings/core/browser/host_content_settings_map.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 } | 89 } |
87 | 90 |
88 void PPAPITestBase::InfoBarObserver::Observe( | 91 void PPAPITestBase::InfoBarObserver::Observe( |
89 int type, | 92 int type, |
90 const content::NotificationSource& source, | 93 const content::NotificationSource& source, |
91 const content::NotificationDetails& details) { | 94 const content::NotificationDetails& details) { |
92 ASSERT_EQ(chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, type); | 95 ASSERT_EQ(chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, type); |
93 // It's not safe to remove the infobar here, since other observers (e.g. the | 96 // It's not safe to remove the infobar here, since other observers (e.g. the |
94 // InfoBarContainer) may still need to access it. Instead, post a task to | 97 // InfoBarContainer) may still need to access it. Instead, post a task to |
95 // do all necessary infobar manipulation as soon as this call stack returns. | 98 // do all necessary infobar manipulation as soon as this call stack returns. |
96 base::MessageLoop::current()->PostTask( | 99 base::ThreadTaskRunnerHandle::Get()->PostTask( |
97 FROM_HERE, base::Bind(&InfoBarObserver::VerifyInfoBarState, | 100 FROM_HERE, |
98 base::Unretained(this))); | 101 base::Bind(&InfoBarObserver::VerifyInfoBarState, base::Unretained(this))); |
99 } | 102 } |
100 | 103 |
101 void PPAPITestBase::InfoBarObserver::VerifyInfoBarState() { | 104 void PPAPITestBase::InfoBarObserver::VerifyInfoBarState() { |
102 content::WebContents* web_contents = | 105 content::WebContents* web_contents = |
103 test_base_->browser()->tab_strip_model()->GetActiveWebContents(); | 106 test_base_->browser()->tab_strip_model()->GetActiveWebContents(); |
104 ASSERT_TRUE(web_contents != NULL); | 107 ASSERT_TRUE(web_contents != NULL); |
105 InfoBarService* infobar_service = | 108 InfoBarService* infobar_service = |
106 InfoBarService::FromWebContents(web_contents); | 109 InfoBarService::FromWebContents(web_contents); |
107 ASSERT_TRUE(infobar_service != NULL); | 110 ASSERT_TRUE(infobar_service != NULL); |
108 | 111 |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 const std::string& base, | 464 const std::string& base, |
462 const std::string& test_case) { | 465 const std::string& test_case) { |
463 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), | 466 return base::StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), |
464 test_case.c_str()); | 467 test_case.c_str()); |
465 } | 468 } |
466 | 469 |
467 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { | 470 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { |
468 // The default content setting for the PPAPI broker is ASK. We purposefully | 471 // The default content setting for the PPAPI broker is ASK. We purposefully |
469 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. | 472 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. |
470 } | 473 } |
OLD | NEW |