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

Side by Side Diff: chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc

Issue 2758323002: Broke out layout metric information from ViewsDelegate to LayoutProvider (Closed)
Patch Set: LayoutDelegate -> LayoutProvider Created 3 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/page_info/page_info_bubble_view.h" 5 #include "chrome/browser/ui/views/page_info/page_info_bubble_view.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" 9 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
10 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
10 #include "chrome/browser/ui/views/page_info/chosen_object_row.h" 11 #include "chrome/browser/ui/views/page_info/chosen_object_row.h"
11 #include "chrome/browser/ui/views/page_info/permission_selector_row.h" 12 #include "chrome/browser/ui/views/page_info/permission_selector_row.h"
12 #include "chrome/browser/usb/usb_chooser_context.h" 13 #include "chrome/browser/usb/usb_chooser_context.h"
13 #include "chrome/browser/usb/usb_chooser_context_factory.h" 14 #include "chrome/browser/usb/usb_chooser_context_factory.h"
14 #include "chrome/test/base/testing_profile.h" 15 #include "chrome/test/base/testing_profile.h"
15 #include "content/public/browser/ssl_status.h" 16 #include "content/public/browser/ssl_status.h"
16 #include "content/public/test/test_browser_thread_bundle.h" 17 #include "content/public/test/test_browser_thread_bundle.h"
17 #include "content/public/test/test_web_contents_factory.h" 18 #include "content/public/test/test_web_contents_factory.h"
18 #include "device/base/mock_device_client.h" 19 #include "device/base/mock_device_client.h"
19 #include "device/usb/mock_usb_device.h" 20 #include "device/usb/mock_usb_device.h"
20 #include "device/usb/mock_usb_service.h" 21 #include "device/usb/mock_usb_service.h"
21 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
22 #include "ui/events/event_utils.h" 23 #include "ui/events/event_utils.h"
23 #include "ui/views/controls/button/menu_button.h" 24 #include "ui/views/controls/button/menu_button.h"
24 #include "ui/views/controls/combobox/combobox.h" 25 #include "ui/views/controls/combobox/combobox.h"
25 #include "ui/views/controls/label.h" 26 #include "ui/views/controls/label.h"
26 #include "ui/views/test/scoped_views_test_helper.h" 27 #include "ui/views/test/scoped_views_test_helper.h"
28 #include "ui/views/test/test_views_delegate.h"
27 29
28 const char* kUrl = "http://www.example.com/index.html"; 30 const char* kUrl = "http://www.example.com/index.html";
29 31
30 namespace test { 32 namespace test {
31 33
32 class PageInfoBubbleViewTestApi { 34 class PageInfoBubbleViewTestApi {
33 public: 35 public:
34 PageInfoBubbleViewTestApi(gfx::NativeView parent, 36 PageInfoBubbleViewTestApi(gfx::NativeView parent,
35 Profile* profile, 37 Profile* profile,
36 content::WebContents* web_contents) 38 content::WebContents* web_contents)
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 125
124 DISALLOW_COPY_AND_ASSIGN(ScopedWebContentsTestHelper); 126 DISALLOW_COPY_AND_ASSIGN(ScopedWebContentsTestHelper);
125 }; 127 };
126 128
127 class PageInfoBubbleViewTest : public testing::Test { 129 class PageInfoBubbleViewTest : public testing::Test {
128 public: 130 public:
129 PageInfoBubbleViewTest() {} 131 PageInfoBubbleViewTest() {}
130 132
131 // testing::Test: 133 // testing::Test:
132 void SetUp() override { 134 void SetUp() override {
135 views_helper_.test_views_delegate()->set_layout_provider(
136 ChromeLayoutProvider::CreateLayoutProvider());
133 views::Widget::InitParams parent_params; 137 views::Widget::InitParams parent_params;
134 parent_params.context = views_helper_.GetContext(); 138 parent_params.context = views_helper_.GetContext();
135 parent_window_ = new views::Widget(); 139 parent_window_ = new views::Widget();
136 parent_window_->Init(parent_params); 140 parent_window_->Init(parent_params);
137 141
138 content::WebContents* web_contents = web_contents_helper_.web_contents(); 142 content::WebContents* web_contents = web_contents_helper_.web_contents();
139 TabSpecificContentSettings::CreateForWebContents(web_contents); 143 TabSpecificContentSettings::CreateForWebContents(web_contents);
140 api_.reset(new test::PageInfoBubbleViewTestApi( 144 api_.reset(new test::PageInfoBubbleViewTestApi(
141 parent_window_->GetNativeView(), web_contents_helper_.profile(), 145 parent_window_->GetNativeView(), web_contents_helper_.profile(),
142 web_contents)); 146 web_contents));
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 262
259 const ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), 263 const ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
260 ui::EventTimeForNow(), 0, 0); 264 ui::EventTimeForNow(), 0, 0);
261 views::ButtonListener* button_listener = 265 views::ButtonListener* button_listener =
262 static_cast<views::ButtonListener*>(object_view); 266 static_cast<views::ButtonListener*>(object_view);
263 button_listener->ButtonPressed(button, event); 267 button_listener->ButtonPressed(button, event);
264 api_->SetPermissionInfo(list); 268 api_->SetPermissionInfo(list);
265 EXPECT_EQ(kExpectedChildren, api_->permissions_view()->child_count()); 269 EXPECT_EQ(kExpectedChildren, api_->permissions_view()->child_count());
266 EXPECT_FALSE(store->HasDevicePermission(origin, origin, device)); 270 EXPECT_FALSE(store->HasDevicePermission(origin, origin, device));
267 } 271 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698