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

Side by Side Diff: ash/metrics/user_metrics_recorder_unittest.cc

Issue 2815043002: Removes ShellPort::IsRunningInMash() (Closed)
Patch Set: dont set instance_ in constructor 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/metrics/user_metrics_recorder.h" 5 #include "ash/metrics/user_metrics_recorder.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "ash/login_status.h" 9 #include "ash/login_status.h"
10 #include "ash/public/cpp/config.h"
10 #include "ash/shelf/shelf_model.h" 11 #include "ash/shelf/shelf_model.h"
11 #include "ash/shell.h" 12 #include "ash/shell.h"
12 #include "ash/shell_port.h" 13 #include "ash/shell_port.h"
13 #include "ash/test/ash_test_base.h" 14 #include "ash/test/ash_test_base.h"
14 #include "ash/test/test_shelf_delegate.h" 15 #include "ash/test/test_shelf_delegate.h"
15 #include "ash/test/test_system_tray_delegate.h" 16 #include "ash/test/test_system_tray_delegate.h"
16 #include "ash/test/user_metrics_recorder_test_api.h" 17 #include "ash/test/user_metrics_recorder_test_api.h"
17 #include "ash/wm_window.h" 18 #include "ash/wm_window.h"
18 #include "base/test/histogram_tester.h" 19 #include "base/test/histogram_tester.h"
19 #include "ui/aura/window.h" 20 #include "ui/aura/window.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 SetUserInActiveDesktopEnvironment(true); 183 SetUserInActiveDesktopEnvironment(true);
183 user_metrics_recorder_test_api()->RecordPeriodicMetrics(); 184 user_metrics_recorder_test_api()->RecordPeriodicMetrics();
184 185
185 histograms().ExpectTotalCount(kAsh_ActiveWindowShowTypeOverTime, 1); 186 histograms().ExpectTotalCount(kAsh_ActiveWindowShowTypeOverTime, 1);
186 } 187 }
187 188
188 // Verify the shelf item counts recorded by the 189 // Verify the shelf item counts recorded by the
189 // UserMetricsRecorder::RecordPeriodicMetrics() method. 190 // UserMetricsRecorder::RecordPeriodicMetrics() method.
190 TEST_F(UserMetricsRecorderTest, ValuesRecordedByRecordShelfItemCounts) { 191 TEST_F(UserMetricsRecorderTest, ValuesRecordedByRecordShelfItemCounts) {
191 // TODO: investigate failure in mash, http://crbug.com/695629. 192 // TODO: investigate failure in mash, http://crbug.com/695629.
192 if (ShellPort::Get()->IsRunningInMash()) 193 if (Shell::GetAshConfig() == Config::MASH)
193 return; 194 return;
194 195
195 test::TestShelfDelegate* test_shelf_delegate = 196 test::TestShelfDelegate* test_shelf_delegate =
196 test::TestShelfDelegate::instance(); 197 test::TestShelfDelegate::instance();
197 SetUserInActiveDesktopEnvironment(true); 198 SetUserInActiveDesktopEnvironment(true);
198 199
199 // Make sure the shelf contains the app list launcher button. 200 // Make sure the shelf contains the app list launcher button.
200 const ShelfItems& shelf_items = Shell::Get()->shelf_model()->items(); 201 const ShelfItems& shelf_items = Shell::Get()->shelf_model()->items();
201 ASSERT_EQ(1u, shelf_items.size()); 202 ASSERT_EQ(1u, shelf_items.size());
202 ASSERT_EQ(TYPE_APP_LIST, shelf_items[0].type); 203 ASSERT_EQ(TYPE_APP_LIST, shelf_items[0].type);
(...skipping 18 matching lines...) Expand all
221 aura::Window* unpinned_window_5 = CreateTestWindow(); 222 aura::Window* unpinned_window_5 = CreateTestWindow();
222 test_shelf_delegate->AddShelfItem(WmWindow::Get(unpinned_window_5)); 223 test_shelf_delegate->AddShelfItem(WmWindow::Get(unpinned_window_5));
223 224
224 user_metrics_recorder_test_api()->RecordPeriodicMetrics(); 225 user_metrics_recorder_test_api()->RecordPeriodicMetrics();
225 histograms().ExpectBucketCount(kAsh_Shelf_NumberOfItems, 5, 1); 226 histograms().ExpectBucketCount(kAsh_Shelf_NumberOfItems, 5, 1);
226 histograms().ExpectBucketCount(kAsh_Shelf_NumberOfPinnedItems, 2, 1); 227 histograms().ExpectBucketCount(kAsh_Shelf_NumberOfPinnedItems, 2, 1);
227 histograms().ExpectBucketCount(kAsh_Shelf_NumberOfUnpinnedItems, 3, 1); 228 histograms().ExpectBucketCount(kAsh_Shelf_NumberOfUnpinnedItems, 3, 1);
228 } 229 }
229 230
230 } // namespace ash 231 } // namespace ash
OLDNEW
« no previous file with comments | « ash/metrics/desktop_task_switch_metric_recorder_unittest.cc ('k') | ash/mus/bridge/shell_port_mash.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698