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

Side by Side Diff: ash/shelf/shelf_application_menu_model_unittest.cc

Issue 2825533003: mash: Prerequisites for removing ShelfDelegate. (Closed)
Patch Set: Refine TestShelfDelegate::IsAppPinned; cleanup. 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 "ash/shelf/shelf_application_menu_model.h" 5 #include "ash/shelf/shelf_application_menu_model.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/test/test_shelf_item_delegate.h"
10 #include "base/macros.h" 9 #include "base/macros.h"
11 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
12 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
13 #include "base/test/histogram_tester.h" 12 #include "base/test/histogram_tester.h"
14 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
15 14
16 namespace ash { 15 namespace ash {
17 16
18 namespace { 17 namespace {
19 18
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 histogram_tester.ExpectBucketCount(kSelectedMenuItemIndexHistogramName, 116 histogram_tester.ExpectBucketCount(kSelectedMenuItemIndexHistogramName,
118 kCommandId, 1); 117 kCommandId, 1);
119 } 118 }
120 119
121 // Verify histogram data is recorded when ExecuteCommand is called. 120 // Verify histogram data is recorded when ExecuteCommand is called.
122 TEST(ShelfApplicationMenuModelTest, VerifyHistogramOnExecute) { 121 TEST(ShelfApplicationMenuModelTest, VerifyHistogramOnExecute) {
123 base::HistogramTester histogram_tester; 122 base::HistogramTester histogram_tester;
124 123
125 std::vector<mojom::MenuItemPtr> items; 124 std::vector<mojom::MenuItemPtr> items;
126 items.push_back(ash::mojom::MenuItem::New()); 125 items.push_back(ash::mojom::MenuItem::New());
127 test::TestShelfItemDelegate test_delegate(nullptr);
128 base::string16 title = base::ASCIIToUTF16("title"); 126 base::string16 title = base::ASCIIToUTF16("title");
129 ShelfApplicationMenuModel menu(title, std::move(items), &test_delegate); 127 ShelfApplicationMenuModel menu(title, std::move(items), nullptr);
130 menu.ExecuteCommand(0, 0); 128 menu.ExecuteCommand(0, 0);
131 129
132 histogram_tester.ExpectTotalCount(kNumItemsEnabledHistogramName, 1); 130 histogram_tester.ExpectTotalCount(kNumItemsEnabledHistogramName, 1);
133 histogram_tester.ExpectTotalCount(kSelectedMenuItemIndexHistogramName, 1); 131 histogram_tester.ExpectTotalCount(kSelectedMenuItemIndexHistogramName, 1);
134 } 132 }
135 133
136 } // namespace ash 134 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698