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

Side by Side Diff: ash/common/devtools/ash_devtools_unittest.cc

Issue 2776543002: Create a unified UIElement interface for Widget, View and Window. (Closed)
Patch Set: . Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ash/common/devtools/ash_devtools_css_agent.h" 5 #include "ash/common/devtools/ash_devtools_css_agent.h"
6 #include "ash/common/devtools/ash_devtools_dom_agent.h" 6 #include "ash/common/devtools/ash_devtools_dom_agent.h"
7 #include "ash/common/test/ash_test.h" 7 #include "ash/common/test/ash_test.h"
8 #include "ash/common/wm_shell.h" 8 #include "ash/common/wm_shell.h"
9 #include "ash/common/wm_window.h" 9 #include "ash/common/wm_window.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
(...skipping 24 matching lines...) Expand all
35 }; 35 };
36 36
37 class FakeFrontendChannel : public FrontendChannel { 37 class FakeFrontendChannel : public FrontendChannel {
38 public: 38 public:
39 FakeFrontendChannel() {} 39 FakeFrontendChannel() {}
40 ~FakeFrontendChannel() override {} 40 ~FakeFrontendChannel() override {}
41 41
42 int CountProtocolNotificationMessageStartsWith(const std::string& message) { 42 int CountProtocolNotificationMessageStartsWith(const std::string& message) {
43 int count = 0; 43 int count = 0;
44 for (const std::string& s : protocol_notification_messages_) { 44 for (const std::string& s : protocol_notification_messages_) {
45 LOG(ERROR) << "CountProtocolNotificationMessageStartsWith: " << s;
45 if (base::StartsWith(s, message, base::CompareCase::SENSITIVE)) 46 if (base::StartsWith(s, message, base::CompareCase::SENSITIVE))
46 count++; 47 count++;
47 } 48 }
48 return count; 49 return count;
49 } 50 }
50 51
51 int CountProtocolNotificationMessage(const std::string& message) { 52 int CountProtocolNotificationMessage(const std::string& message) {
52 return std::count(protocol_notification_messages_.begin(), 53 return std::count(protocol_notification_messages_.begin(),
53 protocol_notification_messages_.end(), message); 54 protocol_notification_messages_.end(), message);
54 } 55 }
55 56
56 // FrontendChannel 57 // FrontendChannel
57 void sendProtocolResponse(int callId, 58 void sendProtocolResponse(int callId,
58 std::unique_ptr<Serializable> message) override {} 59 std::unique_ptr<Serializable> message) override {}
59 void flushProtocolNotifications() override {} 60 void flushProtocolNotifications() override {}
60 void sendProtocolNotification( 61 void sendProtocolNotification(
61 std::unique_ptr<Serializable> message) override { 62 std::unique_ptr<Serializable> message) override {
63 LOG(ERROR) << "---------- protocol_notification_messages_.size(): "
64 << protocol_notification_messages_.size();
62 protocol_notification_messages_.push_back(message->serialize()); 65 protocol_notification_messages_.push_back(message->serialize());
63 } 66 }
64 67
65 private: 68 private:
66 std::vector<std::string> protocol_notification_messages_; 69 std::vector<std::string> protocol_notification_messages_;
67 70
68 DISALLOW_COPY_AND_ASSIGN(FakeFrontendChannel); 71 DISALLOW_COPY_AND_ASSIGN(FakeFrontendChannel);
69 }; 72 };
70 73
71 std::string GetAttributeValue(const std::string& attribute, DOM::Node* node) { 74 std::string GetAttributeValue(const std::string& attribute, DOM::Node* node) {
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 SetStyleTexts(root_view_node, "\nheight: 73;\n ", true); 768 SetStyleTexts(root_view_node, "\nheight: 73;\n ", true);
766 EXPECT_EQ(gfx::Rect(25, 35, 45, 73), root_view->bounds()); 769 EXPECT_EQ(gfx::Rect(25, 35, 45, 73), root_view->bounds());
767 770
768 SetStyleTexts(root_view_node, "\nx: 10; y: 23; width: 52;\nvisibility: 1;\n", 771 SetStyleTexts(root_view_node, "\nx: 10; y: 23; width: 52;\nvisibility: 1;\n",
769 true); 772 true);
770 EXPECT_EQ(gfx::Rect(10, 23, 52, 73), root_view->bounds()); 773 EXPECT_EQ(gfx::Rect(10, 23, 52, 73), root_view->bounds());
771 EXPECT_TRUE(root_view->visible()); 774 EXPECT_TRUE(root_view->visible());
772 } 775 }
773 776
774 } // namespace ash 777 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698