| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chrome/browser/native_app_launcher/native_app_infobar_controller.h" | 5 #import "ios/chrome/browser/native_app_launcher/native_app_infobar_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_types
.h" | 10 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_types
.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 int performedActionCount_; | 50 int performedActionCount_; |
| 51 NativeAppActionType userAction_; | 51 NativeAppActionType userAction_; |
| 52 NativeAppActionType expectedUserAction_; | 52 NativeAppActionType expectedUserAction_; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 class MockInfobarViewDelegate : public InfoBarViewDelegate { | 55 class MockInfobarViewDelegate : public InfoBarViewDelegate { |
| 56 public: | 56 public: |
| 57 void SetInfoBarTargetHeight(int height) override{}; | 57 void SetInfoBarTargetHeight(int height) override {} |
| 58 void InfoBarDidCancel() override{}; | 58 void InfoBarDidCancel() override {} |
| 59 void InfoBarButtonDidPress(NSUInteger button_id) override{}; | 59 void InfoBarButtonDidPress(NSUInteger button_id) override {} |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 protected: | 62 protected: |
| 63 void SetUpWithType(NativeAppControllerType type) { | 63 void SetUpWithType(NativeAppControllerType type) { |
| 64 mockDelegate_.reset(new MockNativeAppInfoBarDelegate(type)); | 64 mockDelegate_.reset(new MockNativeAppInfoBarDelegate(type)); |
| 65 mockInfoBarViewDelegate_.reset(new MockInfobarViewDelegate()); | 65 mockInfoBarViewDelegate_.reset(new MockInfobarViewDelegate()); |
| 66 infobarController_.reset([[NativeAppInfoBarController alloc] | 66 infobarController_.reset([[NativeAppInfoBarController alloc] |
| 67 initWithDelegate:mockInfoBarViewDelegate_.get()]); | 67 initWithDelegate:mockInfoBarViewDelegate_.get()]); |
| 68 [infobarController_ setInfoBarDelegate:mockDelegate_.get()]; | 68 [infobarController_ setInfoBarDelegate:mockDelegate_.get()]; |
| 69 }; | 69 }; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 96 } | 96 } |
| 97 | 97 |
| 98 TEST_F(NativeAppInfoBarControllerTest, TestActionsWithOpenPolicyInfoBar) { | 98 TEST_F(NativeAppInfoBarControllerTest, TestActionsWithOpenPolicyInfoBar) { |
| 99 SetUpWithType(NATIVE_APP_OPEN_POLICY_CONTROLLER); | 99 SetUpWithType(NATIVE_APP_OPEN_POLICY_CONTROLLER); |
| 100 ExpectUserPerformedAction(NATIVE_APP_ACTION_CLICK_ONCE); | 100 ExpectUserPerformedAction(NATIVE_APP_ACTION_CLICK_ONCE); |
| 101 ExpectUserPerformedAction(NATIVE_APP_ACTION_CLICK_ALWAYS); | 101 ExpectUserPerformedAction(NATIVE_APP_ACTION_CLICK_ALWAYS); |
| 102 ExpectUserPerformedAction(NATIVE_APP_ACTION_DISMISS); | 102 ExpectUserPerformedAction(NATIVE_APP_ACTION_DISMISS); |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace | 105 } // namespace |
| OLD | NEW |