OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/web/web_state/js/crw_js_window_id_manager.h" | 5 #import "ios/web/web_state/js/crw_js_window_id_manager.h" |
6 | 6 |
7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #include "base/memory/ptr_util.h" |
8 #import "ios/web/public/test/crw_test_js_injection_receiver.h" | 9 #import "ios/web/public/test/crw_test_js_injection_receiver.h" |
9 #import "ios/web/public/test/js_test_util.h" | 10 #import "ios/web/public/test/js_test_util.h" |
10 #include "ios/web/public/test/scoped_testing_web_client.h" | 11 #include "ios/web/public/test/scoped_testing_web_client.h" |
11 #include "ios/web/public/web_client.h" | 12 #include "ios/web/public/web_client.h" |
12 #import "testing/gtest_mac.h" | 13 #import "testing/gtest_mac.h" |
13 #include "testing/platform_test.h" | 14 #include "testing/platform_test.h" |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 class JSWindowIDManagerTest : public PlatformTest { | 18 class JSWindowIDManagerTest : public PlatformTest { |
18 public: | 19 public: |
19 JSWindowIDManagerTest() : web_client_(make_scoped_ptr(new web::WebClient)) {} | 20 JSWindowIDManagerTest() : web_client_(base::WrapUnique(new web::WebClient)) {} |
20 | 21 |
21 protected: | 22 protected: |
22 void SetUp() override { | 23 void SetUp() override { |
23 PlatformTest::SetUp(); | 24 PlatformTest::SetUp(); |
24 receiver_.reset([[CRWTestJSInjectionReceiver alloc] init]); | 25 receiver_.reset([[CRWTestJSInjectionReceiver alloc] init]); |
25 manager_.reset([[CRWJSWindowIdManager alloc] initWithReceiver:receiver_]); | 26 manager_.reset([[CRWJSWindowIdManager alloc] initWithReceiver:receiver_]); |
26 } | 27 } |
27 | 28 |
28 // Required for CRWJSWindowIdManager creation. | 29 // Required for CRWJSWindowIdManager creation. |
29 base::scoped_nsobject<CRWTestJSInjectionReceiver> receiver_; | 30 base::scoped_nsobject<CRWTestJSInjectionReceiver> receiver_; |
(...skipping 12 matching lines...) Expand all Loading... |
42 base::scoped_nsobject<CRWTestJSInjectionReceiver> receiver2( | 43 base::scoped_nsobject<CRWTestJSInjectionReceiver> receiver2( |
43 [[CRWTestJSInjectionReceiver alloc] init]); | 44 [[CRWTestJSInjectionReceiver alloc] init]); |
44 base::scoped_nsobject<CRWJSWindowIdManager> manager2( | 45 base::scoped_nsobject<CRWJSWindowIdManager> manager2( |
45 [[CRWJSWindowIdManager alloc] initWithReceiver:receiver2]); | 46 [[CRWJSWindowIdManager alloc] initWithReceiver:receiver2]); |
46 [manager2 inject]; | 47 [manager2 inject]; |
47 NSString* windowID2 = [manager2 windowId]; | 48 NSString* windowID2 = [manager2 windowId]; |
48 EXPECT_NSNE(windowID, windowID2); | 49 EXPECT_NSNE(windowID, windowID2); |
49 } | 50 } |
50 | 51 |
51 } // namespace | 52 } // namespace |
OLD | NEW |