Chromium Code Reviews| Index: ios/chrome/browser/store_kit/store_kit_tab_helper_unittest.mm |
| diff --git a/ios/chrome/browser/store_kit/store_kit_tab_helper_unittest.mm b/ios/chrome/browser/store_kit/store_kit_tab_helper_unittest.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1276b1105d0a3c1b502dce7ad90635912e2ee444 |
| --- /dev/null |
| +++ b/ios/chrome/browser/store_kit/store_kit_tab_helper_unittest.mm |
| @@ -0,0 +1,49 @@ |
| +// 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/store_kit/store_kit_tab_helper.h" |
| + |
| +#include "base/macros.h" |
| +#include "ios/web/public/test/fakes/test_web_state.h" |
| +#import "ios/web/public/test/web_test.h" |
| +#import "third_party/ocmock/OCMock/OCMock.h" |
| + |
| +#if !defined(__has_feature) || !__has_feature(objc_arc) |
| +#error "This file requires ARC support." |
| +#endif |
| + |
| +namespace { |
| + |
| +class StoreKitTabHelperTest : public web::WebTest { |
| + public: |
| + StoreKitTabHelperTest(){}; |
|
sdefresne
2017/03/06 19:44:03
Remove trailing semi-colon. You can also use = def
pkl (ping after 24h if needed)
2017/03/07 01:17:54
Done.
|
| + ~StoreKitTabHelperTest() override = default; |
| + |
| + protected: |
| + void SetUp() override { |
| + web::WebTest::SetUp(); |
| + StoreKitTabHelper::CreateForWebState(&web_state_); |
|
sdefresne
2017/03/06 19:44:03
nit: if possible avoid using SetUp/TearDown in tes
pkl (ping after 24h if needed)
2017/03/07 01:17:54
Done.
|
| + } |
| + |
| + web::TestWebState web_state_; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(StoreKitTabHelperTest); |
| +}; |
| + |
| +TEST_F(StoreKitTabHelperTest, Constructor) { |
| + // Verifies that a StoreKitTabHelper is available in WebState. |
| + StoreKitTabHelper* tab_helper = StoreKitTabHelper::FromWebState(&web_state_); |
| + EXPECT_TRUE(tab_helper); |
|
sdefresne
2017/03/06 19:44:03
You should use ASSERT_TRUE here as it will stop th
|
| + |
| + if (tab_helper) { |
| + id mock_store_kit_launcher = |
| + [OCMockObject niceMockForProtocol:@protocol(StoreKitLauncher)]; |
| + // Verifies that GetLauncher returns the mock launcher object that was set. |
| + tab_helper->SetLauncher(mock_store_kit_launcher); |
| + EXPECT_EQ(mock_store_kit_launcher, tab_helper->GetLauncher()); |
| + } |
| +} |
| + |
| +} // namespace |