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

Side by Side Diff: chrome/browser/android/vr_shell/ui_elements/exit_prompt_unittest.cc

Issue 2966793002: NOT FOR REVIEW - convert to cc animation
Patch Set: switch to transform operations Created 3 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 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 #include "chrome/browser/android/vr_shell/ui_elements/exit_prompt.h" 5 #include "chrome/browser/android/vr_shell/ui_elements/exit_prompt.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "chrome/browser/android/vr_shell/textures/exit_prompt_texture.h" 10 #include "chrome/browser/android/vr_shell/textures/exit_prompt_texture.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 private: 47 private:
48 void OnPrimaryButtonPressed() { primary_button_pressed_ = true; } 48 void OnPrimaryButtonPressed() { primary_button_pressed_ = true; }
49 void OnSecondaryButtonPressed() { secondary_button_pressed_ = true; } 49 void OnSecondaryButtonPressed() { secondary_button_pressed_ = true; }
50 50
51 bool primary_button_pressed_ = false; 51 bool primary_button_pressed_ = false;
52 bool secondary_button_pressed_ = false; 52 bool secondary_button_pressed_ = false;
53 }; 53 };
54 54
55 TestExitPrompt::TestExitPrompt() 55 TestExitPrompt::TestExitPrompt()
56 : ExitPrompt(512, 56 : ExitPrompt(1,
57 512,
57 base::Bind(&TestExitPrompt::OnPrimaryButtonPressed, 58 base::Bind(&TestExitPrompt::OnPrimaryButtonPressed,
58 base::Unretained(this)), 59 base::Unretained(this)),
59 base::Bind(&TestExitPrompt::OnSecondaryButtonPressed, 60 base::Bind(&TestExitPrompt::OnSecondaryButtonPressed,
60 base::Unretained(this))) {} 61 base::Unretained(this))) {}
61 62
62 TEST(ExitPromptTest, PrimaryButtonCallbackCalled) { 63 TEST(ExitPromptTest, PrimaryButtonCallbackCalled) {
63 TestExitPrompt prompt; 64 TestExitPrompt prompt;
64 MockExitPromptTexture* texture = new MockExitPromptTexture(); 65 MockExitPromptTexture* texture = new MockExitPromptTexture();
65 // Called twice from OnButtonDown and twice from OnButtonUp. 66 // Called twice from OnButtonDown and twice from OnButtonUp.
66 EXPECT_CALL(*texture, HitsPrimaryButton(gfx::PointF())) 67 EXPECT_CALL(*texture, HitsPrimaryButton(gfx::PointF()))
(...skipping 26 matching lines...) Expand all
93 prompt.SetTextureForTesting(std::move(texture)); 94 prompt.SetTextureForTesting(std::move(texture));
94 95
95 prompt.OnButtonDown(gfx::PointF()); 96 prompt.OnButtonDown(gfx::PointF());
96 prompt.OnButtonUp(gfx::PointF()); 97 prompt.OnButtonUp(gfx::PointF());
97 98
98 EXPECT_FALSE(prompt.primary_button_pressed()); 99 EXPECT_FALSE(prompt.primary_button_pressed());
99 EXPECT_TRUE(prompt.secondary_button_pressed()); 100 EXPECT_TRUE(prompt.secondary_button_pressed());
100 } 101 }
101 102
102 } // namespace vr_shell 103 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698