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

Side by Side Diff: chrome/browser/ui/views/frame/web_contents_close_handler_unittest.cc

Issue 686463004: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 1 month 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
« no previous file with comments | « chrome/browser/ui/views/frame/top_container_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 class MockWebContentsCloseHandlerDelegate 11 class MockWebContentsCloseHandlerDelegate
12 : public WebContentsCloseHandlerDelegate { 12 : public WebContentsCloseHandlerDelegate {
13 public: 13 public:
14 explicit MockWebContentsCloseHandlerDelegate() 14 explicit MockWebContentsCloseHandlerDelegate()
15 : got_clone_(false), 15 : got_clone_(false),
16 got_destroy_(false) { 16 got_destroy_(false) {
17 } 17 }
18 virtual ~MockWebContentsCloseHandlerDelegate() {} 18 ~MockWebContentsCloseHandlerDelegate() override {}
19 19
20 void Clear() { 20 void Clear() {
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 void CloneWebContentsLayer() override { got_clone_ = true; }
32 got_clone_ = true; 32 void DestroyClonedLayer() override { got_destroy_ = true; }
33 }
34 virtual void DestroyClonedLayer() override {
35 got_destroy_ = true;
36 }
37 33
38 private: 34 private:
39 base::MessageLoopForUI message_loop_; 35 base::MessageLoopForUI message_loop_;
40 bool got_clone_; 36 bool got_clone_;
41 bool got_destroy_; 37 bool got_destroy_;
42 38
43 DISALLOW_COPY_AND_ASSIGN(MockWebContentsCloseHandlerDelegate); 39 DISALLOW_COPY_AND_ASSIGN(MockWebContentsCloseHandlerDelegate);
44 }; 40 };
45 41
46 // ----------------------------------------------------------------------------- 42 // -----------------------------------------------------------------------------
47 43
48 class WebContentsCloseHandlerTest : public testing::Test { 44 class WebContentsCloseHandlerTest : public testing::Test {
49 public: 45 public:
50 WebContentsCloseHandlerTest() : close_handler_(&close_handler_delegate_) {} 46 WebContentsCloseHandlerTest() : close_handler_(&close_handler_delegate_) {}
51 virtual ~WebContentsCloseHandlerTest() {} 47 ~WebContentsCloseHandlerTest() override {}
52 48
53 protected: 49 protected:
54 bool IsTimerRunning() const { 50 bool IsTimerRunning() const {
55 return close_handler_.timer_.IsRunning(); 51 return close_handler_.timer_.IsRunning();
56 } 52 }
57 53
58 MockWebContentsCloseHandlerDelegate close_handler_delegate_; 54 MockWebContentsCloseHandlerDelegate close_handler_delegate_;
59 WebContentsCloseHandler close_handler_; 55 WebContentsCloseHandler close_handler_;
60 56
61 private: 57 private:
(...skipping 25 matching lines...) Expand all
87 // Verifies the timer is started after a close. 83 // Verifies the timer is started after a close.
88 TEST_F(WebContentsCloseHandlerTest, DontDestroyImmediatleyAfterCancel) { 84 TEST_F(WebContentsCloseHandlerTest, DontDestroyImmediatleyAfterCancel) {
89 close_handler_.WillCloseAllTabs(); 85 close_handler_.WillCloseAllTabs();
90 close_handler_delegate_.Clear(); 86 close_handler_delegate_.Clear();
91 close_handler_.CloseAllTabsCanceled(); 87 close_handler_.CloseAllTabsCanceled();
92 EXPECT_FALSE(close_handler_delegate_.got_destroy()); 88 EXPECT_FALSE(close_handler_delegate_.got_destroy());
93 EXPECT_FALSE(close_handler_delegate_.got_clone()); 89 EXPECT_FALSE(close_handler_delegate_.got_clone());
94 EXPECT_TRUE(IsTimerRunning()); 90 EXPECT_TRUE(IsTimerRunning());
95 } 91 }
96 92
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/top_container_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698