OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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. |
| 4 |
| 5 #import "ios/chrome/browser/web/tab_id_tab_helper.h" |
| 6 |
| 7 #import "ios/web/public/test/fakes/test_web_state.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "testing/platform_test.h" |
| 10 |
| 11 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 12 #error "This file requires ARC support." |
| 13 #endif |
| 14 |
| 15 // Test fixture for TabIDTabHelper class. |
| 16 class TabIDTabHelperTest : public PlatformTest { |
| 17 protected: |
| 18 web::TestWebState first_web_state_; |
| 19 web::TestWebState second_web_state_; |
| 20 }; |
| 21 |
| 22 // Tests that a TabID is returned for a WebState, and TabID's are different |
| 23 // for different WebStates. |
| 24 TEST_F(TabIDTabHelperTest, TabIDForWebState) { |
| 25 TabIDTabHelper::CreateForWebState(&first_web_state_); |
| 26 TabIDTabHelper::CreateForWebState(&second_web_state_); |
| 27 |
| 28 const TabID& first_tab_id = |
| 29 TabIDTabHelper::FromWebState(&first_web_state_)->tab_id(); |
| 30 const TabID& second_tab_id = |
| 31 TabIDTabHelper::FromWebState(&second_web_state_)->tab_id(); |
| 32 |
| 33 EXPECT_FALSE(first_tab_id.empty()); |
| 34 EXPECT_FALSE(second_tab_id.empty()); |
| 35 EXPECT_NE(first_tab_id, second_tab_id); |
| 36 } |
OLD | NEW |