1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ios/web/public/browser_state.h"
7 #include "base/supports_user_data.h"
8 #include "ios/web/public/test/test_browser_state.h"
9 #include "testing/gtest/include/gtest/gtest.h"
12 class TestSupportsUserData
: public base::SupportsUserData
{
14 TestSupportsUserData() {}
15 ~TestSupportsUserData() override
{}
19 TEST(BrowserStateTest
, FromSupportsUserData_NullPointer
) {
20 DCHECK_EQ(static_cast<web::BrowserState
*>(nullptr),
21 web::BrowserState::FromSupportsUserData(nullptr));
24 TEST(BrowserStateTest
, FromSupportsUserData_NonBrowserState
) {
25 TestSupportsUserData supports_user_data
;
26 DCHECK_EQ(static_cast<web::BrowserState
*>(nullptr),
27 web::BrowserState::FromSupportsUserData(&supports_user_data
));
30 TEST(BrowserStateTest
, FromSupportsUserData
) {
31 web::TestBrowserState browser_state
;
32 DCHECK_EQ(&browser_state
,
33 web::BrowserState::FromSupportsUserData(&browser_state
));