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