| 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 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h" | 5 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "chrome/browser/ui/views/frame/web_contents_close_handler_delegate.h" | 8 #include "chrome/browser/ui/views/frame/web_contents_close_handler_delegate.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 got_clone_ = got_destroy_ = false; | 21 got_clone_ = got_destroy_ = false; |
| 22 } | 22 } |
| 23 | 23 |
| 24 bool got_clone() const { return got_clone_; } | 24 bool got_clone() const { return got_clone_; } |
| 25 void clear_got_clone() { got_clone_ = false; } | 25 void clear_got_clone() { got_clone_ = false; } |
| 26 | 26 |
| 27 bool got_destroy() const { return got_destroy_; } | 27 bool got_destroy() const { return got_destroy_; } |
| 28 void clear_got_destroy() { got_destroy_ = false; } | 28 void clear_got_destroy() { got_destroy_ = false; } |
| 29 | 29 |
| 30 // WebContentsCloseHandlerDelegate: | 30 // WebContentsCloseHandlerDelegate: |
| 31 virtual void CloneWebContentsLayer() OVERRIDE { | 31 virtual void CloneWebContentsLayer() override { |
| 32 got_clone_ = true; | 32 got_clone_ = true; |
| 33 } | 33 } |
| 34 virtual void DestroyClonedLayer() OVERRIDE { | 34 virtual void DestroyClonedLayer() override { |
| 35 got_destroy_ = true; | 35 got_destroy_ = true; |
| 36 } | 36 } |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 base::MessageLoopForUI message_loop_; | 39 base::MessageLoopForUI message_loop_; |
| 40 bool got_clone_; | 40 bool got_clone_; |
| 41 bool got_destroy_; | 41 bool got_destroy_; |
| 42 | 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(MockWebContentsCloseHandlerDelegate); | 43 DISALLOW_COPY_AND_ASSIGN(MockWebContentsCloseHandlerDelegate); |
| 44 }; | 44 }; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // Verifies the timer is started after a close. | 87 // Verifies the timer is started after a close. |
| 88 TEST_F(WebContentsCloseHandlerTest, DontDestroyImmediatleyAfterCancel) { | 88 TEST_F(WebContentsCloseHandlerTest, DontDestroyImmediatleyAfterCancel) { |
| 89 close_handler_.WillCloseAllTabs(); | 89 close_handler_.WillCloseAllTabs(); |
| 90 close_handler_delegate_.Clear(); | 90 close_handler_delegate_.Clear(); |
| 91 close_handler_.CloseAllTabsCanceled(); | 91 close_handler_.CloseAllTabsCanceled(); |
| 92 EXPECT_FALSE(close_handler_delegate_.got_destroy()); | 92 EXPECT_FALSE(close_handler_delegate_.got_destroy()); |
| 93 EXPECT_FALSE(close_handler_delegate_.got_clone()); | 93 EXPECT_FALSE(close_handler_delegate_.got_clone()); |
| 94 EXPECT_TRUE(IsTimerRunning()); | 94 EXPECT_TRUE(IsTimerRunning()); |
| 95 } | 95 } |
| 96 | 96 |
| OLD | NEW |