Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Unified Diff: ios/chrome/browser/store_kit/store_kit_tab_helper_unittest.mm

Issue 2731553005: Introduced StoreKitTabHelper class (Closed)
Patch Set: line break for 80 columns Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698