2013-01-03 18:24:24 +01:00
|
|
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
2012-04-03 03:34:16 +02:00
|
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
|
|
// can be found in the LICENSE file.
|
|
|
|
|
2016-11-18 18:31:21 +01:00
|
|
|
#include "tests/ceftests/test_handler.h"
|
2014-07-15 00:18:51 +02:00
|
|
|
|
2024-01-20 18:00:09 +01:00
|
|
|
#include <memory>
|
2023-10-13 19:48:01 +02:00
|
|
|
#include <sstream>
|
|
|
|
|
2021-06-17 22:08:01 +02:00
|
|
|
#include "include/base/cef_callback.h"
|
2016-11-08 19:52:36 +01:00
|
|
|
#include "include/base/cef_logging.h"
|
2012-04-12 22:21:50 +02:00
|
|
|
#include "include/cef_command_line.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
#include "include/cef_stream.h"
|
2021-02-23 21:08:33 +01:00
|
|
|
#include "include/views/cef_browser_view.h"
|
|
|
|
#include "include/views/cef_window.h"
|
2014-07-15 20:10:40 +02:00
|
|
|
#include "include/wrapper/cef_closure_task.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
#include "include/wrapper/cef_stream_resource_handler.h"
|
2020-08-14 21:28:23 +02:00
|
|
|
#include "tests/ceftests/test_request.h"
|
2023-01-13 19:49:33 +01:00
|
|
|
#include "tests/ceftests/test_util.h"
|
2016-11-18 00:52:42 +01:00
|
|
|
#include "tests/shared/common/client_switches.h"
|
2016-01-19 21:09:01 +01:00
|
|
|
|
2023-10-13 19:48:01 +02:00
|
|
|
// Set to 1 to enable verbose debugging info logging.
|
|
|
|
#define VERBOSE_DEBUGGING 0
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
namespace {
|
|
|
|
|
2023-11-14 18:16:43 +01:00
|
|
|
bool UseViewsGlobal() {
|
2023-10-13 19:48:01 +02:00
|
|
|
static bool use_views = []() {
|
|
|
|
return CefCommandLine::GetGlobalCommandLine()->HasSwitch(
|
|
|
|
client::switches::kUseViews);
|
|
|
|
}();
|
|
|
|
return use_views;
|
|
|
|
}
|
|
|
|
|
2016-01-19 21:09:01 +01:00
|
|
|
// Delegate implementation for the CefWindow that will host the Views-based
|
|
|
|
// browser.
|
|
|
|
class TestWindowDelegate : public CefWindowDelegate {
|
|
|
|
public:
|
|
|
|
// Create a new top-level Window hosting |browser_view|.
|
2023-10-13 19:48:01 +02:00
|
|
|
static void CreateBrowserWindow(TestHandler* handler,
|
|
|
|
CefRefPtr<CefBrowserView> browser_view,
|
2016-01-19 21:09:01 +01:00
|
|
|
const std::string& title) {
|
2023-10-13 19:48:01 +02:00
|
|
|
CefWindow::CreateTopLevelWindow(new TestWindowDelegate(
|
|
|
|
handler, browser_view, "CefUnitTestViews " + title));
|
2016-01-19 21:09:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// CefWindowDelegate methods:
|
|
|
|
|
|
|
|
void OnWindowCreated(CefRefPtr<CefWindow> window) override {
|
|
|
|
// Add the browser view and show the window.
|
|
|
|
window->CenterWindow(CefSize(800, 600));
|
|
|
|
window->SetTitle(title_);
|
|
|
|
window->AddChildView(browser_view_);
|
|
|
|
window->Show();
|
2023-10-13 19:48:01 +02:00
|
|
|
|
|
|
|
// With Chrome runtime, the Browser is not created until after the
|
|
|
|
// BrowserView is assigned to the Window.
|
|
|
|
browser_id_ = browser_view_->GetBrowser()->GetIdentifier();
|
|
|
|
handler_->OnWindowCreated(browser_id_);
|
2016-01-19 21:09:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void OnWindowDestroyed(CefRefPtr<CefWindow> window) override {
|
2023-10-13 19:48:01 +02:00
|
|
|
auto browser = browser_view_->GetBrowser();
|
2016-01-19 21:09:01 +01:00
|
|
|
browser_view_ = nullptr;
|
2023-10-13 19:48:01 +02:00
|
|
|
handler_->OnWindowDestroyed(browser_id_);
|
2016-01-19 21:09:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CanClose(CefRefPtr<CefWindow> window) override {
|
|
|
|
// Allow the window to close if the browser says it's OK.
|
|
|
|
CefRefPtr<CefBrowser> browser = browser_view_->GetBrowser();
|
2023-01-02 23:59:03 +01:00
|
|
|
if (browser) {
|
2016-01-19 21:09:01 +01:00
|
|
|
return browser->GetHost()->TryCloseBrowser();
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2016-01-19 21:09:01 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2023-10-13 19:48:01 +02:00
|
|
|
TestWindowDelegate(TestHandler* handler,
|
|
|
|
CefRefPtr<CefBrowserView> browser_view,
|
2016-01-19 21:09:01 +01:00
|
|
|
const CefString& title)
|
2023-10-13 19:48:01 +02:00
|
|
|
: handler_(handler), browser_view_(browser_view), title_(title) {}
|
2016-01-19 21:09:01 +01:00
|
|
|
|
2023-10-13 19:48:01 +02:00
|
|
|
TestHandler* const handler_;
|
2016-01-19 21:09:01 +01:00
|
|
|
CefRefPtr<CefBrowserView> browser_view_;
|
2023-10-13 19:48:01 +02:00
|
|
|
int browser_id_ = 0;
|
2016-01-19 21:09:01 +01:00
|
|
|
CefString title_;
|
|
|
|
|
|
|
|
IMPLEMENT_REFCOUNTING(TestWindowDelegate);
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate);
|
|
|
|
};
|
|
|
|
|
|
|
|
// Delegate implementation for the CefBrowserView.
|
|
|
|
class TestBrowserViewDelegate : public CefBrowserViewDelegate {
|
|
|
|
public:
|
2023-10-13 19:48:01 +02:00
|
|
|
explicit TestBrowserViewDelegate(TestHandler* handler) : handler_(handler) {}
|
2016-01-19 21:09:01 +01:00
|
|
|
|
|
|
|
// CefBrowserViewDelegate methods:
|
|
|
|
|
2023-10-13 19:48:01 +02:00
|
|
|
void OnBrowserDestroyed(CefRefPtr<CefBrowserView> browser_view,
|
|
|
|
CefRefPtr<CefBrowser> browser) override {
|
|
|
|
#if VERBOSE_DEBUGGING
|
|
|
|
LOG(INFO) << handler_->debug_string_prefix() << browser->GetIdentifier()
|
|
|
|
<< ": OnBrowserDestroyed";
|
|
|
|
#endif
|
|
|
|
// Always close the containing Window when the browser is destroyed.
|
|
|
|
if (auto window = browser_view->GetWindow()) {
|
|
|
|
#if VERBOSE_DEBUGGING
|
|
|
|
LOG(INFO) << handler_->debug_string_prefix() << browser->GetIdentifier()
|
|
|
|
<< ": OnBrowserDestroyed Close";
|
|
|
|
#endif
|
|
|
|
window->Close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CefRefPtr<CefBrowserViewDelegate> GetDelegateForPopupBrowserView(
|
|
|
|
CefRefPtr<CefBrowserView> browser_view,
|
|
|
|
const CefBrowserSettings& settings,
|
|
|
|
CefRefPtr<CefClient> client,
|
|
|
|
bool is_devtools) override {
|
|
|
|
if (client.get() == handler_) {
|
|
|
|
// Use the same Delegate when using the same TestHandler instance.
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Return a new Delegate when using a different TestHandler instance.
|
|
|
|
auto* handler = static_cast<TestHandler*>(client.get());
|
|
|
|
return new TestBrowserViewDelegate(handler);
|
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
bool OnPopupBrowserViewCreated(CefRefPtr<CefBrowserView> browser_view,
|
|
|
|
CefRefPtr<CefBrowserView> popup_browser_view,
|
|
|
|
bool is_devtools) override {
|
2023-10-13 19:48:01 +02:00
|
|
|
// The popup may use a different TestHandler instance.
|
|
|
|
auto* handler = static_cast<TestHandler*>(
|
|
|
|
popup_browser_view->GetBrowser()->GetHost()->GetClient().get());
|
|
|
|
|
2016-01-19 21:09:01 +01:00
|
|
|
// Create our own Window for popups. It will show itself after creation.
|
2023-10-13 19:48:01 +02:00
|
|
|
TestWindowDelegate::CreateBrowserWindow(handler, popup_browser_view,
|
2017-05-17 11:29:28 +02:00
|
|
|
is_devtools ? "DevTools" : "Popup");
|
2016-01-19 21:09:01 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2023-10-13 19:48:01 +02:00
|
|
|
TestHandler* const handler_;
|
|
|
|
|
2016-01-19 21:09:01 +01:00
|
|
|
IMPLEMENT_REFCOUNTING(TestBrowserViewDelegate);
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(TestBrowserViewDelegate);
|
|
|
|
};
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
} // namespace
|
|
|
|
|
2013-07-15 22:25:59 +02:00
|
|
|
// TestHandler::CompletionState
|
|
|
|
|
2024-01-20 18:00:09 +01:00
|
|
|
TestHandler::CompletionState::CompletionState(int total) : total_(total) {
|
2016-11-15 22:18:41 +01:00
|
|
|
event_ = CefWaitableEvent::CreateWaitableEvent(true, false);
|
2013-07-15 22:25:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void TestHandler::CompletionState::TestComplete() {
|
|
|
|
if (++count_ == total_) {
|
|
|
|
count_ = 0;
|
2015-03-02 21:25:14 +01:00
|
|
|
|
|
|
|
// Signal that the test is now complete. Do not access any object members
|
|
|
|
// after this call because |this| might be deleted.
|
2016-11-15 22:18:41 +01:00
|
|
|
event_->Signal();
|
2013-07-15 22:25:59 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestHandler::CompletionState::WaitForTests() {
|
|
|
|
// Wait for the test to complete
|
2016-11-15 22:18:41 +01:00
|
|
|
event_->Wait();
|
2013-07-15 22:25:59 +02:00
|
|
|
|
|
|
|
// Reset the event so the same test can be executed again.
|
2016-11-15 22:18:41 +01:00
|
|
|
event_->Reset();
|
2013-07-15 22:25:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// TestHandler::Collection
|
|
|
|
|
|
|
|
TestHandler::Collection::Collection(CompletionState* completion_state)
|
|
|
|
: completion_state_(completion_state) {
|
2014-01-28 00:31:03 +01:00
|
|
|
EXPECT_TRUE(completion_state_);
|
2013-07-15 22:25:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void TestHandler::Collection::AddTestHandler(TestHandler* test_handler) {
|
2014-01-28 00:31:03 +01:00
|
|
|
EXPECT_EQ(test_handler->completion_state_, completion_state_);
|
2013-07-15 22:25:59 +02:00
|
|
|
handler_list_.push_back(test_handler);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestHandler::Collection::ExecuteTests() {
|
2014-01-28 00:31:03 +01:00
|
|
|
EXPECT_GT(handler_list_.size(), 0UL);
|
2013-07-15 22:25:59 +02:00
|
|
|
|
|
|
|
TestHandlerList::const_iterator it;
|
|
|
|
|
|
|
|
it = handler_list_.begin();
|
2023-01-02 23:59:03 +01:00
|
|
|
for (; it != handler_list_.end(); ++it) {
|
2013-07-15 22:25:59 +02:00
|
|
|
(*it)->SetupTest();
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2013-07-15 22:25:59 +02:00
|
|
|
|
|
|
|
completion_state_->WaitForTests();
|
|
|
|
|
|
|
|
it = handler_list_.begin();
|
2023-01-02 23:59:03 +01:00
|
|
|
for (; it != handler_list_.end(); ++it) {
|
2013-07-15 22:25:59 +02:00
|
|
|
(*it)->RunTest();
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2013-07-15 22:25:59 +02:00
|
|
|
|
|
|
|
completion_state_->WaitForTests();
|
|
|
|
}
|
|
|
|
|
2015-01-10 00:40:26 +01:00
|
|
|
// TestHandler::UIThreadHelper
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
TestHandler::UIThreadHelper::UIThreadHelper() : weak_ptr_factory_(this) {}
|
2015-01-10 00:40:26 +01:00
|
|
|
|
2021-06-19 21:54:45 +02:00
|
|
|
void TestHandler::UIThreadHelper::PostTask(base::OnceClosure task) {
|
2015-01-10 00:40:26 +01:00
|
|
|
EXPECT_UI_THREAD();
|
2021-06-19 21:54:45 +02:00
|
|
|
CefPostTask(TID_UI,
|
|
|
|
base::BindOnce(&UIThreadHelper::TaskHelper,
|
|
|
|
weak_ptr_factory_.GetWeakPtr(), std::move(task)));
|
2015-01-10 00:40:26 +01:00
|
|
|
}
|
|
|
|
|
2021-06-19 21:54:45 +02:00
|
|
|
void TestHandler::UIThreadHelper::PostDelayedTask(base::OnceClosure task,
|
2017-05-17 11:29:28 +02:00
|
|
|
int delay_ms) {
|
2015-01-10 00:40:26 +01:00
|
|
|
EXPECT_UI_THREAD();
|
2021-06-19 21:54:45 +02:00
|
|
|
CefPostDelayedTask(
|
|
|
|
TID_UI,
|
|
|
|
base::BindOnce(&UIThreadHelper::TaskHelper,
|
|
|
|
weak_ptr_factory_.GetWeakPtr(), std::move(task)),
|
|
|
|
delay_ms);
|
2015-01-10 00:40:26 +01:00
|
|
|
}
|
|
|
|
|
2021-06-19 21:54:45 +02:00
|
|
|
void TestHandler::UIThreadHelper::TaskHelper(base::OnceClosure task) {
|
2015-01-10 00:40:26 +01:00
|
|
|
EXPECT_UI_THREAD();
|
2021-06-19 21:54:45 +02:00
|
|
|
std::move(task).Run();
|
2015-01-10 00:40:26 +01:00
|
|
|
}
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
// TestHandler
|
|
|
|
|
2023-10-18 00:16:06 +02:00
|
|
|
// static
|
|
|
|
std::atomic<size_t> TestHandler::test_handler_count_{0U};
|
2013-03-19 23:59:33 +01:00
|
|
|
|
2013-07-15 22:25:59 +02:00
|
|
|
TestHandler::TestHandler(CompletionState* completion_state)
|
2023-11-14 18:16:43 +01:00
|
|
|
: debug_string_prefix_(MakeDebugStringPrefix()),
|
|
|
|
use_views_(UseViewsGlobal()) {
|
2023-10-18 00:16:06 +02:00
|
|
|
test_handler_count_++;
|
|
|
|
|
2013-07-15 22:25:59 +02:00
|
|
|
if (completion_state) {
|
|
|
|
completion_state_ = completion_state;
|
|
|
|
completion_state_owned_ = false;
|
|
|
|
} else {
|
|
|
|
completion_state_ = new CompletionState(1);
|
|
|
|
completion_state_owned_ = true;
|
|
|
|
}
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TestHandler::~TestHandler() {
|
2015-01-10 00:40:26 +01:00
|
|
|
DCHECK(!ui_thread_helper_.get());
|
2023-01-02 23:59:03 +01:00
|
|
|
if (destroy_test_expected_) {
|
2015-01-10 00:40:26 +01:00
|
|
|
EXPECT_TRUE(destroy_test_called_);
|
2023-01-02 23:59:03 +01:00
|
|
|
} else {
|
2015-01-10 00:40:26 +01:00
|
|
|
EXPECT_FALSE(destroy_test_called_);
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2014-01-28 00:31:03 +01:00
|
|
|
EXPECT_TRUE(browser_map_.empty());
|
2023-10-13 19:48:01 +02:00
|
|
|
EXPECT_TRUE(browser_status_map_.empty());
|
2014-01-28 00:31:03 +01:00
|
|
|
|
2023-01-02 23:59:03 +01:00
|
|
|
if (completion_state_owned_) {
|
2013-07-15 22:25:59 +02:00
|
|
|
delete completion_state_;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-01-10 00:40:26 +01:00
|
|
|
|
2023-01-02 23:59:03 +01:00
|
|
|
if (destroy_event_) {
|
2015-01-10 00:40:26 +01:00
|
|
|
destroy_event_->Signal();
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2023-10-18 00:16:06 +02:00
|
|
|
|
|
|
|
test_handler_count_--;
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void TestHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
|
2014-01-28 00:31:03 +01:00
|
|
|
EXPECT_UI_THREAD();
|
|
|
|
|
2017-05-04 23:53:27 +02:00
|
|
|
const int browser_id = browser->GetIdentifier();
|
|
|
|
EXPECT_EQ(browser_map_.find(browser_id), browser_map_.end());
|
|
|
|
if (browser_map_.empty()) {
|
|
|
|
first_browser_id_ = browser_id;
|
|
|
|
first_browser_ = browser;
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
2017-05-04 23:53:27 +02:00
|
|
|
browser_map_.insert(std::make_pair(browser_id, browser));
|
2023-10-13 19:48:01 +02:00
|
|
|
|
2023-11-14 18:16:43 +01:00
|
|
|
const bool views_hosted = !!CefBrowserView::GetForBrowser(browser);
|
|
|
|
OnCreated(browser_id, NT_BROWSER, views_hosted);
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void TestHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
|
2014-01-28 00:31:03 +01:00
|
|
|
EXPECT_UI_THREAD();
|
2013-03-19 23:59:33 +01:00
|
|
|
|
2017-05-04 23:53:27 +02:00
|
|
|
// Free the browser pointer so that the browser can be destroyed.
|
|
|
|
const int browser_id = browser->GetIdentifier();
|
|
|
|
BrowserMap::iterator it = browser_map_.find(browser_id);
|
|
|
|
EXPECT_NE(it, browser_map_.end());
|
|
|
|
browser_map_.erase(it);
|
2014-01-28 00:31:03 +01:00
|
|
|
|
2017-05-04 23:53:27 +02:00
|
|
|
if (browser_id == first_browser_id_) {
|
|
|
|
first_browser_id_ = 0;
|
2020-01-15 14:34:01 +01:00
|
|
|
first_browser_ = nullptr;
|
2017-05-04 23:53:27 +02:00
|
|
|
}
|
2014-01-28 00:31:03 +01:00
|
|
|
|
2023-10-13 19:48:01 +02:00
|
|
|
OnClosed(browser_id, NT_BROWSER);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestHandler::OnWindowCreated(int browser_id) {
|
2023-11-14 18:16:43 +01:00
|
|
|
CHECK(use_views_);
|
2023-10-13 19:48:01 +02:00
|
|
|
EXPECT_UI_THREAD();
|
2023-11-14 18:16:43 +01:00
|
|
|
OnCreated(browser_id, NT_WINDOW, /*views_hosted=*/true);
|
2023-10-13 19:48:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void TestHandler::OnWindowDestroyed(int browser_id) {
|
2023-11-14 18:16:43 +01:00
|
|
|
CHECK(use_views_);
|
2023-10-13 19:48:01 +02:00
|
|
|
EXPECT_UI_THREAD();
|
|
|
|
OnClosed(browser_id, NT_WINDOW);
|
|
|
|
}
|
|
|
|
|
2023-11-14 18:16:43 +01:00
|
|
|
void TestHandler::OnCreated(int browser_id,
|
|
|
|
NotifyType type,
|
|
|
|
bool views_hosted) {
|
|
|
|
CHECK(use_views_ || !views_hosted);
|
|
|
|
|
2023-11-28 18:05:52 +01:00
|
|
|
const bool has_value =
|
|
|
|
browser_status_map_.find(browser_id) != browser_status_map_.end();
|
2023-11-14 18:16:43 +01:00
|
|
|
|
2023-10-13 19:48:01 +02:00
|
|
|
auto& browser_status = browser_status_map_[browser_id];
|
2023-11-14 18:16:43 +01:00
|
|
|
if (has_value) {
|
|
|
|
CHECK_EQ(browser_status.views_hosted, views_hosted);
|
|
|
|
} else {
|
|
|
|
browser_status.views_hosted = views_hosted;
|
|
|
|
}
|
|
|
|
|
2023-10-13 19:48:01 +02:00
|
|
|
EXPECT_FALSE(browser_status.got_created[type])
|
|
|
|
<< "Duplicate call to OnCreated(" << browser_id << ", "
|
|
|
|
<< (type == NT_BROWSER ? "BROWSER" : "WINDOW") << ")";
|
|
|
|
browser_status.got_created[type].yes();
|
|
|
|
|
2023-10-18 00:16:06 +02:00
|
|
|
#if VERBOSE_DEBUGGING
|
|
|
|
bool creation_complete = false;
|
|
|
|
|
2023-10-13 19:48:01 +02:00
|
|
|
// When using Views, wait for both Browser and Window notifications.
|
2023-11-14 18:16:43 +01:00
|
|
|
if (browser_status.views_hosted) {
|
2023-10-13 19:48:01 +02:00
|
|
|
creation_complete = browser_status.got_created[NT_BROWSER] &&
|
|
|
|
browser_status.got_created[NT_WINDOW];
|
|
|
|
} else {
|
|
|
|
creation_complete = browser_status.got_created[NT_BROWSER];
|
|
|
|
}
|
|
|
|
|
|
|
|
LOG(INFO) << debug_string_prefix_ << browser_id << ": OnCreated type="
|
|
|
|
<< (type == NT_BROWSER ? "BROWSER" : "WINDOW")
|
|
|
|
<< " creation_complete=" << creation_complete;
|
2023-10-18 00:16:06 +02:00
|
|
|
#endif // VERBOSE_DEBUGGING
|
2023-10-13 19:48:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void TestHandler::OnClosed(int browser_id, NotifyType type) {
|
|
|
|
bool close_complete = false;
|
|
|
|
|
|
|
|
auto& browser_status = browser_status_map_[browser_id];
|
|
|
|
EXPECT_FALSE(browser_status.got_closed[type])
|
|
|
|
<< "Duplicate call to OnClosed(" << browser_id << ", "
|
|
|
|
<< (type == NT_BROWSER ? "BROWSER" : "WINDOW") << ")";
|
|
|
|
browser_status.got_closed[type].yes();
|
|
|
|
|
|
|
|
// When using Views, wait for both Browser and Window notifications.
|
2023-11-14 18:16:43 +01:00
|
|
|
if (browser_status.views_hosted) {
|
2023-10-13 19:48:01 +02:00
|
|
|
close_complete = browser_status.got_closed[NT_BROWSER] &&
|
|
|
|
browser_status.got_closed[NT_WINDOW];
|
|
|
|
} else {
|
|
|
|
close_complete = browser_status.got_closed[NT_BROWSER];
|
|
|
|
}
|
|
|
|
|
2023-10-18 00:16:06 +02:00
|
|
|
if (close_complete) {
|
|
|
|
browser_status_map_.erase(browser_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test may be complete if no Browsers/Windows are remaining.
|
|
|
|
const bool all_browsers_closed = AllBrowsersClosed();
|
2023-10-13 19:48:01 +02:00
|
|
|
|
|
|
|
#if VERBOSE_DEBUGGING
|
|
|
|
LOG(INFO) << debug_string_prefix_ << browser_id
|
|
|
|
<< ": OnClosed type=" << (type == NT_BROWSER ? "BROWSER" : "WINDOW")
|
|
|
|
<< " close_complete=" << close_complete
|
2023-10-18 00:16:06 +02:00
|
|
|
<< " all_browsers_closed=" << all_browsers_closed;
|
2023-10-13 19:48:01 +02:00
|
|
|
#endif
|
|
|
|
|
2023-10-18 00:16:06 +02:00
|
|
|
if (all_browsers_closed) {
|
|
|
|
// May result in |this| being deleted.
|
|
|
|
MaybeTestComplete();
|
2023-10-13 19:48:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string TestHandler::MakeDebugStringPrefix() const {
|
|
|
|
#if VERBOSE_DEBUGGING
|
|
|
|
std::stringstream ss;
|
|
|
|
ss << "TestHandler [0x" << std::hex << this << "]: ";
|
|
|
|
return ss.str();
|
|
|
|
#else
|
|
|
|
return std::string();
|
|
|
|
#endif
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
|
|
|
|
2016-10-27 18:34:19 +02:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
CefResponse::HeaderMap ToCefHeaderMap(
|
|
|
|
const ResourceContent::HeaderMap& headerMap) {
|
|
|
|
CefResponse::HeaderMap result;
|
|
|
|
ResourceContent::HeaderMap::const_iterator it = headerMap.begin();
|
|
|
|
for (; it != headerMap.end(); ++it) {
|
|
|
|
result.insert(std::pair<CefString, CefString>(it->first, it->second));
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
} // namespace
|
2016-10-27 18:34:19 +02:00
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
CefRefPtr<CefResourceHandler> TestHandler::GetResourceHandler(
|
2017-05-17 11:29:28 +02:00
|
|
|
CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefFrame> frame,
|
|
|
|
CefRefPtr<CefRequest> request) {
|
2014-01-28 00:31:03 +01:00
|
|
|
EXPECT_IO_THREAD();
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
if (resource_map_.size() > 0) {
|
2020-08-14 21:28:23 +02:00
|
|
|
const std::string& url = test_request::GetPathURL(request->GetURL());
|
|
|
|
ResourceMap::const_iterator it = resource_map_.find(url);
|
2012-04-03 03:34:16 +02:00
|
|
|
if (it != resource_map_.end()) {
|
|
|
|
// Return the previously mapped resource
|
2017-05-17 11:29:28 +02:00
|
|
|
CefRefPtr<CefStreamReader> stream = CefStreamReader::CreateForData(
|
|
|
|
static_cast<void*>(const_cast<char*>(it->second.content().c_str())),
|
|
|
|
it->second.content().length());
|
|
|
|
return new CefStreamResourceHandler(
|
|
|
|
200, "OK", it->second.mimeType(),
|
2016-10-27 18:34:19 +02:00
|
|
|
ToCefHeaderMap(it->second.headerMap()), stream);
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-15 14:34:01 +01:00
|
|
|
return nullptr;
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
|
|
|
|
2016-11-08 19:52:36 +01:00
|
|
|
void TestHandler::OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
|
|
|
TerminationStatus status) {
|
|
|
|
LOG(WARNING) << "OnRenderProcessTerminated: status = " << status << ".";
|
|
|
|
}
|
|
|
|
|
2021-05-21 03:42:58 +02:00
|
|
|
CefRefPtr<CefBrowser> TestHandler::GetBrowser() const {
|
2014-01-28 00:31:03 +01:00
|
|
|
return first_browser_;
|
|
|
|
}
|
|
|
|
|
2021-05-21 03:42:58 +02:00
|
|
|
int TestHandler::GetBrowserId() const {
|
2014-01-28 00:31:03 +01:00
|
|
|
return first_browser_id_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestHandler::GetAllBrowsers(BrowserMap* map) {
|
|
|
|
EXPECT_UI_THREAD();
|
|
|
|
EXPECT_TRUE(map);
|
|
|
|
*map = browser_map_;
|
|
|
|
}
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
void TestHandler::ExecuteTest() {
|
2014-01-28 00:31:03 +01:00
|
|
|
EXPECT_EQ(completion_state_->total(), 1);
|
2013-07-15 22:25:59 +02:00
|
|
|
|
2015-01-10 00:40:26 +01:00
|
|
|
// Reset any state from the previous run.
|
2023-10-23 17:17:50 +02:00
|
|
|
if (test_timeout_called_) {
|
|
|
|
test_timeout_called_ = false;
|
|
|
|
}
|
2023-01-02 23:59:03 +01:00
|
|
|
if (destroy_test_called_) {
|
2015-01-10 00:40:26 +01:00
|
|
|
destroy_test_called_ = false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-01-10 00:40:26 +01:00
|
|
|
|
|
|
|
// Run the test.
|
2012-04-03 03:34:16 +02:00
|
|
|
RunTest();
|
|
|
|
|
2015-01-10 00:40:26 +01:00
|
|
|
// Wait for the test to complete.
|
2013-07-15 22:25:59 +02:00
|
|
|
completion_state_->WaitForTests();
|
|
|
|
}
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2013-07-15 22:25:59 +02:00
|
|
|
void TestHandler::SetupComplete() {
|
|
|
|
// Signal that the test setup is complete.
|
|
|
|
completion_state_->TestComplete();
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void TestHandler::DestroyTest() {
|
2014-01-28 00:31:03 +01:00
|
|
|
if (!CefCurrentlyOn(TID_UI)) {
|
2021-06-19 21:54:45 +02:00
|
|
|
CefPostTask(TID_UI, base::BindOnce(&TestHandler::DestroyTest, this));
|
2014-01-28 00:31:03 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-01-10 00:40:26 +01:00
|
|
|
EXPECT_TRUE(destroy_test_expected_);
|
2023-01-02 23:59:03 +01:00
|
|
|
if (destroy_test_called_) {
|
2015-01-10 00:40:26 +01:00
|
|
|
return;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-01-10 00:40:26 +01:00
|
|
|
destroy_test_called_ = true;
|
|
|
|
|
2014-01-28 00:31:03 +01:00
|
|
|
if (!browser_map_.empty()) {
|
|
|
|
// Use a copy of the map since the original may be modified while we're
|
|
|
|
// iterating.
|
|
|
|
BrowserMap browser_map = browser_map_;
|
|
|
|
|
2017-05-04 23:53:27 +02:00
|
|
|
// Tell all browsers to close.
|
2014-01-28 00:31:03 +01:00
|
|
|
BrowserMap::const_iterator it = browser_map.begin();
|
2023-01-02 23:59:03 +01:00
|
|
|
for (; it != browser_map.end(); ++it) {
|
2016-01-19 21:09:01 +01:00
|
|
|
CloseBrowser(it->second, false);
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2014-01-28 00:31:03 +01:00
|
|
|
}
|
2015-01-10 00:40:26 +01:00
|
|
|
}
|
|
|
|
|
2015-05-23 03:57:31 +02:00
|
|
|
void TestHandler::OnTestTimeout(int timeout_ms, bool treat_as_error) {
|
2015-01-10 00:40:26 +01:00
|
|
|
EXPECT_UI_THREAD();
|
2023-10-18 00:16:06 +02:00
|
|
|
|
|
|
|
EXPECT_FALSE(test_timeout_called_);
|
|
|
|
test_timeout_called_ = true;
|
|
|
|
|
2017-08-11 18:56:52 +02:00
|
|
|
if (treat_as_error) {
|
2015-05-23 03:57:31 +02:00
|
|
|
EXPECT_TRUE(false) << "Test timed out after " << timeout_ms << "ms";
|
2017-08-11 18:56:52 +02:00
|
|
|
}
|
2023-10-18 00:16:06 +02:00
|
|
|
|
|
|
|
EXPECT_FALSE(AllBrowsersClosed() && AllowTestCompletionWhenAllBrowsersClose())
|
|
|
|
<< "Test timed out unexpectedly; should be complete";
|
|
|
|
|
2023-10-23 17:17:50 +02:00
|
|
|
// Keep |this| alive until after the method completes.
|
|
|
|
CefRefPtr<TestHandler> self(this);
|
|
|
|
|
2023-10-18 00:16:06 +02:00
|
|
|
// Close any remaining browsers.
|
2015-01-10 00:40:26 +01:00
|
|
|
DestroyTest();
|
2023-10-18 00:16:06 +02:00
|
|
|
|
|
|
|
// Reset signal completion count.
|
|
|
|
if (signal_completion_count_ > 0) {
|
|
|
|
signal_completion_count_ = 0;
|
|
|
|
MaybeTestComplete();
|
|
|
|
}
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void TestHandler::CreateBrowser(const CefString& url,
|
2019-03-19 10:42:54 +01:00
|
|
|
CefRefPtr<CefRequestContext> request_context,
|
|
|
|
CefRefPtr<CefDictionaryValue> extra_info) {
|
2023-11-14 18:16:43 +01:00
|
|
|
if (!CefCurrentlyOn(TID_UI)) {
|
2021-06-19 21:54:45 +02:00
|
|
|
CefPostTask(TID_UI, base::BindOnce(&TestHandler::CreateBrowser, this, url,
|
|
|
|
request_context, extra_info));
|
2016-01-19 21:09:01 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
CefWindowInfo windowInfo;
|
|
|
|
CefBrowserSettings settings;
|
2016-01-19 21:09:01 +01:00
|
|
|
|
2023-11-14 18:16:43 +01:00
|
|
|
if (use_views_) {
|
2016-01-19 21:09:01 +01:00
|
|
|
// Create the BrowserView.
|
|
|
|
CefRefPtr<CefBrowserView> browser_view = CefBrowserView::CreateBrowserView(
|
2019-03-19 10:42:54 +01:00
|
|
|
this, url, settings, extra_info, request_context,
|
2023-10-13 19:48:01 +02:00
|
|
|
new TestBrowserViewDelegate(this));
|
2016-01-19 21:09:01 +01:00
|
|
|
|
|
|
|
// Create the Window. It will show itself after creation.
|
2023-10-13 19:48:01 +02:00
|
|
|
TestWindowDelegate::CreateBrowserWindow(this, browser_view, std::string());
|
2021-02-23 21:08:33 +01:00
|
|
|
} else {
|
2012-04-03 03:34:16 +02:00
|
|
|
#if defined(OS_WIN)
|
2020-01-15 14:34:01 +01:00
|
|
|
windowInfo.SetAsPopup(nullptr, "CefUnitTest");
|
2016-01-19 21:09:01 +01:00
|
|
|
windowInfo.style |= WS_VISIBLE;
|
2012-04-03 03:34:16 +02:00
|
|
|
#endif
|
2019-03-19 10:42:54 +01:00
|
|
|
CefBrowserHost::CreateBrowser(windowInfo, this, url, settings, extra_info,
|
2016-01-19 21:09:01 +01:00
|
|
|
request_context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
void TestHandler::CloseBrowser(CefRefPtr<CefBrowser> browser,
|
|
|
|
bool force_close) {
|
2023-10-13 19:48:01 +02:00
|
|
|
#if VERBOSE_DEBUGGING
|
|
|
|
LOG(INFO) << "TestHandler: " << browser->GetIdentifier()
|
|
|
|
<< ": CloseBrowser force_close=" << force_close;
|
|
|
|
#endif
|
2016-01-19 21:09:01 +01:00
|
|
|
browser->GetHost()->CloseBrowser(force_close);
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
|
|
|
|
2016-10-27 18:34:19 +02:00
|
|
|
void TestHandler::AddResource(const std::string& url,
|
|
|
|
const std::string& content,
|
|
|
|
const std::string& mime_type,
|
|
|
|
const ResourceContent::HeaderMap& header_map) {
|
|
|
|
ResourceContent rc = ResourceContent(content, mime_type, header_map);
|
|
|
|
AddResourceEx(url, rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestHandler::AddResourceEx(const std::string& url,
|
|
|
|
const ResourceContent& content) {
|
2014-01-28 00:31:03 +01:00
|
|
|
if (!CefCurrentlyOn(TID_IO)) {
|
2021-06-19 21:54:45 +02:00
|
|
|
CefPostTask(TID_IO, base::BindOnce(&TestHandler::AddResourceEx, this, url,
|
|
|
|
content));
|
2014-01-28 00:31:03 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-04-16 23:15:27 +02:00
|
|
|
// Ignore the query component, if any.
|
|
|
|
std::string urlStr = url;
|
2013-08-14 23:45:22 +02:00
|
|
|
size_t idx = urlStr.find('?');
|
2023-01-02 23:59:03 +01:00
|
|
|
if (idx > 0) {
|
2017-05-17 11:29:28 +02:00
|
|
|
urlStr = urlStr.substr(0, idx);
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2012-04-16 23:15:27 +02:00
|
|
|
|
2016-10-27 18:34:19 +02:00
|
|
|
resource_map_.insert(std::make_pair(urlStr, content));
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void TestHandler::ClearResources() {
|
2014-01-28 00:31:03 +01:00
|
|
|
if (!CefCurrentlyOn(TID_IO)) {
|
2021-06-19 21:54:45 +02:00
|
|
|
CefPostTask(TID_IO, base::BindOnce(&TestHandler::ClearResources, this));
|
2014-01-28 00:31:03 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
resource_map_.clear();
|
|
|
|
}
|
|
|
|
|
2015-05-23 03:57:31 +02:00
|
|
|
void TestHandler::SetTestTimeout(int timeout_ms, bool treat_as_error) {
|
2015-01-10 00:40:26 +01:00
|
|
|
if (!CefCurrentlyOn(TID_UI)) {
|
2021-06-19 21:54:45 +02:00
|
|
|
CefPostTask(TID_UI, base::BindOnce(&TestHandler::SetTestTimeout, this,
|
|
|
|
timeout_ms, treat_as_error));
|
2015-01-10 00:40:26 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-06-18 14:28:37 +02:00
|
|
|
if (destroy_test_called_) {
|
|
|
|
// No need to set the timeout if the test has already completed.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-01-13 19:49:33 +01:00
|
|
|
const auto timeout = GetConfiguredTestTimeout(timeout_ms);
|
|
|
|
if (treat_as_error && !timeout) {
|
2015-01-10 00:40:26 +01:00
|
|
|
return;
|
2015-05-23 03:57:31 +02:00
|
|
|
}
|
2015-01-10 00:40:26 +01:00
|
|
|
|
|
|
|
// Use a weak reference to |this| via UIThreadHelper so that the TestHandler
|
|
|
|
// can be destroyed before the timeout expires.
|
|
|
|
GetUIThreadHelper()->PostDelayedTask(
|
2021-06-19 21:54:45 +02:00
|
|
|
base::BindOnce(&TestHandler::OnTestTimeout, base::Unretained(this),
|
2023-01-13 19:49:33 +01:00
|
|
|
*timeout, treat_as_error),
|
|
|
|
*timeout);
|
2015-01-10 00:40:26 +01:00
|
|
|
}
|
|
|
|
|
2023-11-14 18:16:43 +01:00
|
|
|
void TestHandler::SetUseViews(bool use_views) {
|
|
|
|
if (!CefCurrentlyOn(TID_UI)) {
|
|
|
|
CefPostTask(TID_UI,
|
|
|
|
base::BindOnce(&TestHandler::SetUseViews, this, use_views));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
use_views_ = use_views;
|
|
|
|
}
|
|
|
|
|
2023-10-18 00:16:06 +02:00
|
|
|
void TestHandler::SetSignalTestCompletionCount(size_t count) {
|
|
|
|
#if VERBOSE_DEBUGGING
|
|
|
|
LOG(INFO) << debug_string_prefix_
|
|
|
|
<< "SetSignalTestCompletionCount count=" << count;
|
|
|
|
#endif
|
|
|
|
signal_completion_count_ = count;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestHandler::SignalTestCompletion() {
|
2014-01-28 00:31:03 +01:00
|
|
|
if (!CefCurrentlyOn(TID_UI)) {
|
2023-10-18 00:16:06 +02:00
|
|
|
CefPostTask(TID_UI,
|
|
|
|
base::BindOnce(&TestHandler::SignalTestCompletion, this));
|
2014-01-28 00:31:03 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-10-18 00:16:06 +02:00
|
|
|
if (test_timeout_called_) {
|
|
|
|
// Ignore any signals that arrive after test timeout.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
CHECK_GT(signal_completion_count_, 0U);
|
|
|
|
signal_completion_count_--;
|
|
|
|
|
|
|
|
#if VERBOSE_DEBUGGING
|
|
|
|
LOG(INFO) << debug_string_prefix_
|
|
|
|
<< "SignalTestComplete remaining=" << signal_completion_count_;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (signal_completion_count_ == 0) {
|
|
|
|
// May result in |this| being deleted.
|
|
|
|
MaybeTestComplete();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TestHandler::AllowTestCompletionWhenAllBrowsersClose() const {
|
|
|
|
EXPECT_UI_THREAD();
|
|
|
|
return signal_completion_count_ == 0U;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TestHandler::AllBrowsersClosed() const {
|
|
|
|
EXPECT_UI_THREAD();
|
|
|
|
return browser_status_map_.empty();
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestHandler::MaybeTestComplete() {
|
|
|
|
EXPECT_UI_THREAD();
|
|
|
|
|
|
|
|
const bool all_browsers_closed = AllBrowsersClosed();
|
|
|
|
const bool allow_test_completion = AllowTestCompletionWhenAllBrowsersClose();
|
|
|
|
|
|
|
|
#if VERBOSE_DEBUGGING
|
|
|
|
LOG(INFO) << debug_string_prefix_
|
|
|
|
<< "MaybeTestComplete all_browsers_closed=" << all_browsers_closed
|
|
|
|
<< " allow_test_completion=" << allow_test_completion;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (all_browsers_closed && allow_test_completion) {
|
|
|
|
TestComplete();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestHandler::TestComplete() {
|
|
|
|
EXPECT_UI_THREAD();
|
|
|
|
EXPECT_TRUE(AllBrowsersClosed());
|
|
|
|
EXPECT_TRUE(AllowTestCompletionWhenAllBrowsersClose());
|
|
|
|
|
2023-10-13 19:48:01 +02:00
|
|
|
#if VERBOSE_DEBUGGING
|
|
|
|
LOG(INFO) << debug_string_prefix_ << "TestComplete";
|
|
|
|
#endif
|
|
|
|
|
2023-10-18 00:16:06 +02:00
|
|
|
// Cancel any pending tasks posted via UIThreadHelper.
|
|
|
|
ui_thread_helper_.reset();
|
|
|
|
|
2014-01-28 00:31:03 +01:00
|
|
|
completion_state_->TestComplete();
|
|
|
|
}
|
|
|
|
|
2015-01-10 00:40:26 +01:00
|
|
|
TestHandler::UIThreadHelper* TestHandler::GetUIThreadHelper() {
|
|
|
|
EXPECT_UI_THREAD();
|
2019-06-18 14:28:37 +02:00
|
|
|
CHECK(!destroy_test_called_);
|
2015-01-10 00:40:26 +01:00
|
|
|
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!ui_thread_helper_.get()) {
|
2024-01-20 18:00:09 +01:00
|
|
|
ui_thread_helper_ = std::make_unique<UIThreadHelper>();
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2015-01-10 00:40:26 +01:00
|
|
|
return ui_thread_helper_.get();
|
|
|
|
}
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
// global functions
|
|
|
|
|
2012-04-12 22:21:50 +02:00
|
|
|
bool TestFailed() {
|
|
|
|
CefRefPtr<CefCommandLine> command_line =
|
|
|
|
CefCommandLine::GetGlobalCommandLine();
|
|
|
|
if (command_line->HasSwitch("single-process")) {
|
|
|
|
// Check for a failure on the current test only.
|
2017-05-17 11:29:28 +02:00
|
|
|
return ::testing::UnitTest::GetInstance()
|
|
|
|
->current_test_info()
|
|
|
|
->result()
|
|
|
|
->Failed();
|
2012-04-12 22:21:50 +02:00
|
|
|
} else {
|
|
|
|
// Check for any global failure.
|
|
|
|
return ::testing::UnitTest::GetInstance()->Failed();
|
|
|
|
}
|
|
|
|
}
|