| Index: ios/chrome/browser/web/tab_id_tab_helper_unittest.mm
|
| diff --git a/ios/chrome/browser/web/tab_id_tab_helper_unittest.mm b/ios/chrome/browser/web/tab_id_tab_helper_unittest.mm
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..addbaec0744564b42d916c9ded0932baee36eab0
|
| --- /dev/null
|
| +++ b/ios/chrome/browser/web/tab_id_tab_helper_unittest.mm
|
| @@ -0,0 +1,36 @@
|
| +// Copyright 2017 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.
|
| +
|
| +#import "ios/chrome/browser/web/tab_id_tab_helper.h"
|
| +
|
| +#import "ios/web/public/test/fakes/test_web_state.h"
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
| +#include "testing/platform_test.h"
|
| +
|
| +#if !defined(__has_feature) || !__has_feature(objc_arc)
|
| +#error "This file requires ARC support."
|
| +#endif
|
| +
|
| +// Test fixture for TabIDTabHelper class.
|
| +class TabIDTabHelperTest : public PlatformTest {
|
| + protected:
|
| + web::TestWebState first_web_state_;
|
| + web::TestWebState second_web_state_;
|
| +};
|
| +
|
| +// Tests that a TabID is returned for a WebState, and TabID's are different
|
| +// for different WebStates.
|
| +TEST_F(TabIDTabHelperTest, TabIDForWebState) {
|
| + TabIDTabHelper::CreateForWebState(&first_web_state_);
|
| + TabIDTabHelper::CreateForWebState(&second_web_state_);
|
| +
|
| + const TabID& first_tab_id =
|
| + TabIDTabHelper::FromWebState(&first_web_state_)->tab_id();
|
| + const TabID& second_tab_id =
|
| + TabIDTabHelper::FromWebState(&second_web_state_)->tab_id();
|
| +
|
| + EXPECT_FALSE(first_tab_id.empty());
|
| + EXPECT_FALSE(second_tab_id.empty());
|
| + EXPECT_NE(first_tab_id, second_tab_id);
|
| +}
|
|
|