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 #import "testing/gtest_mac.h" | |
10 #include "testing/platform_test.h" | |
11 | |
12 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
13 #error "This file requires ARC support." | |
14 #endif | |
15 | |
16 // Test fixture for TabIDTabHelper class. | |
17 class TabIDTabHelperTest : public PlatformTest { | |
18 protected: | |
19 web::TestWebState first_web_state_; | |
20 web::TestWebState second_web_state_; | |
21 }; | |
22 | |
23 // Tests that a TabID is returned for a WebState, and TabID's are different | |
24 // for different WebStates. | |
25 TEST_F(TabIDTabHelperTest, TabIDForWebState) { | |
Eugene But (OOO till 7-30)
2017/06/23 22:44:56
Would it be useful to test serialization?
edchin
2017/06/26 16:20:57
Will do.
| |
26 TabIDTabHelper::CreateForWebState(&first_web_state_); | |
27 TabIDTabHelper::CreateForWebState(&second_web_state_); | |
28 | |
29 const NSString* first_tab_id = | |
30 TabIDTabHelper::FromWebState(&first_web_state_)->tab_id(); | |
31 const NSString* second_tab_id = | |
32 TabIDTabHelper::FromWebState(&second_web_state_)->tab_id(); | |
33 | |
34 EXPECT_GT([first_tab_id length], 0U); | |
35 EXPECT_GT([second_tab_id length], 0U); | |
36 EXPECT_NSNE(first_tab_id, second_tab_id); | |
37 } | |
OLD | NEW |