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

Side by Side Diff: chrome/browser/ui/website_settings/permission_bubble_manager_unittest.cc

Issue 671653002: Standardize usage of virtual/override/final in chrome/browser/ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/ui/website_settings/mock_permission_bubble_request.h" 8 #include "chrome/browser/ui/website_settings/mock_permission_bubble_request.h"
9 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" 9 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
10 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" 10 #include "chrome/browser/ui/website_settings/permission_bubble_request.h"
11 #include "chrome/browser/ui/website_settings/permission_bubble_view.h" 11 #include "chrome/browser/ui/website_settings/permission_bubble_view.h"
12 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
13 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 13 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 namespace { 16 namespace {
17 17
18 class MockView : public PermissionBubbleView { 18 class MockView : public PermissionBubbleView {
19 public: 19 public:
20 MockView() : shown_(false), can_accept_updates_(true), delegate_(NULL) {} 20 MockView() : shown_(false), can_accept_updates_(true), delegate_(NULL) {}
21 virtual ~MockView() {} 21 ~MockView() override {}
22 22
23 void Clear() { 23 void Clear() {
24 shown_ = false; 24 shown_ = false;
25 can_accept_updates_ = true; 25 can_accept_updates_ = true;
26 delegate_ = NULL; 26 delegate_ = NULL;
27 permission_requests_.clear(); 27 permission_requests_.clear();
28 permission_states_.clear(); 28 permission_states_.clear();
29 } 29 }
30 30
31 // PermissionBubbleView: 31 // PermissionBubbleView:
32 virtual void SetDelegate(Delegate* delegate) override { 32 void SetDelegate(Delegate* delegate) override { delegate_ = delegate; }
33 delegate_ = delegate;
34 }
35 33
36 virtual void Show( 34 void Show(const std::vector<PermissionBubbleRequest*>& requests,
37 const std::vector<PermissionBubbleRequest*>& requests, 35 const std::vector<bool>& accept_state,
38 const std::vector<bool>& accept_state, 36 bool customization_state_) override {
39 bool customization_state_) override {
40 shown_ = true; 37 shown_ = true;
41 permission_requests_ = requests; 38 permission_requests_ = requests;
42 permission_states_ = accept_state; 39 permission_states_ = accept_state;
43 } 40 }
44 41
45 virtual void Hide() override { 42 void Hide() override { shown_ = false; }
46 shown_ = false;
47 }
48 43
49 virtual bool CanAcceptRequestUpdate() override { 44 bool CanAcceptRequestUpdate() override { return can_accept_updates_; }
50 return can_accept_updates_;
51 }
52 45
53 virtual bool IsVisible() override { 46 bool IsVisible() override { return shown_; }
54 return shown_;
55 }
56 47
57 bool shown_; 48 bool shown_;
58 bool can_accept_updates_; 49 bool can_accept_updates_;
59 Delegate* delegate_; 50 Delegate* delegate_;
60 std::vector<PermissionBubbleRequest*> permission_requests_; 51 std::vector<PermissionBubbleRequest*> permission_requests_;
61 std::vector<bool> permission_states_; 52 std::vector<bool> permission_states_;
62 }; 53 };
63 54
64 } // namespace 55 } // namespace
65 56
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 EXPECT_FALSE(request2_.finished()); 514 EXPECT_FALSE(request2_.finished());
524 EXPECT_FALSE(iframe_request_other_domain_.finished()); 515 EXPECT_FALSE(iframe_request_other_domain_.finished());
525 EXPECT_TRUE(view_.shown_); 516 EXPECT_TRUE(view_.shown_);
526 Closing(); 517 Closing();
527 EXPECT_TRUE(request2_.finished()); 518 EXPECT_TRUE(request2_.finished());
528 EXPECT_FALSE(iframe_request_other_domain_.finished()); 519 EXPECT_FALSE(iframe_request_other_domain_.finished());
529 Closing(); 520 Closing();
530 EXPECT_TRUE(iframe_request_other_domain_.finished()); 521 EXPECT_TRUE(iframe_request_other_domain_.finished());
531 EXPECT_FALSE(view_.shown_); 522 EXPECT_FALSE(view_.shown_);
532 } 523 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698