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

Side by Side Diff: chrome/browser/power/process_power_collector_unittest.cc

Issue 583583008: Rename AppsClient -> AppWindowClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix mac & test Created 6 years, 3 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 "chrome/browser/power/process_power_collector.h" 5 #include "chrome/browser/power/process_power_collector.h"
6 6
7 #include "chrome/browser/profiles/profile_manager.h" 7 #include "chrome/browser/profiles/profile_manager.h"
8 #include "chrome/browser/ui/apps/chrome_app_delegate.h" 8 #include "chrome/browser/ui/apps/chrome_app_delegate.h"
9 #include "chrome/browser/ui/browser_commands.h" 9 #include "chrome/browser/ui/browser_commands.h"
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" 10 #include "chrome/browser/ui/tabs/tab_strip_model.h"
11 #include "chrome/test/base/browser_with_test_window_test.h" 11 #include "chrome/test/base/browser_with_test_window_test.h"
12 #include "chrome/test/base/testing_browser_process.h" 12 #include "chrome/test/base/testing_browser_process.h"
13 #include "chrome/test/base/testing_profile_manager.h" 13 #include "chrome/test/base/testing_profile_manager.h"
14 #include "components/power/origin_power_map.h" 14 #include "components/power/origin_power_map.h"
15 #include "components/power/origin_power_map_factory.h" 15 #include "components/power/origin_power_map_factory.h"
16 #include "content/public/browser/site_instance.h" 16 #include "content/public/browser/site_instance.h"
17 #include "content/public/test/browser_test_utils.h" 17 #include "content/public/test/browser_test_utils.h"
18 #include "content/public/test/mock_render_process_host.h" 18 #include "content/public/test/mock_render_process_host.h"
19 #include "extensions/browser/app_window/app_window_client.h"
19 #include "extensions/browser/app_window/app_window_contents.h" 20 #include "extensions/browser/app_window/app_window_contents.h"
20 #include "extensions/browser/app_window/app_window_registry.h" 21 #include "extensions/browser/app_window/app_window_registry.h"
21 #include "extensions/browser/app_window/apps_client.h"
22 #include "extensions/browser/app_window/native_app_window.h" 22 #include "extensions/browser/app_window/native_app_window.h"
23 #include "extensions/common/extension.h" 23 #include "extensions/common/extension.h"
24 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
25 #include "url/gurl.h" 25 #include "url/gurl.h"
26 26
27 #if defined(OS_CHROMEOS) 27 #if defined(OS_CHROMEOS)
28 #include "chromeos/dbus/power_manager/power_supply_properties.pb.h" 28 #include "chromeos/dbus/power_manager/power_supply_properties.pb.h"
29 #endif 29 #endif
30 30
31 using power::OriginPowerMap; 31 using power::OriginPowerMap;
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 char kTestAppId[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; 280 char kTestAppId[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
281 scoped_refptr<extensions::Extension> extension( 281 scoped_refptr<extensions::Extension> extension(
282 extensions::Extension::Create(extension_path, 282 extensions::Extension::Create(extension_path,
283 extensions::Manifest::INTERNAL, 283 extensions::Manifest::INTERNAL,
284 manifest, 284 manifest,
285 extensions::Extension::NO_FLAGS, 285 extensions::Extension::NO_FLAGS,
286 kTestAppId, 286 kTestAppId,
287 &error)); 287 &error));
288 EXPECT_TRUE(extension.get()) << error; 288 EXPECT_TRUE(extension.get()) << error;
289 // Increment the apps count to avoid a DCHECK later. 289 // Increment the apps count to avoid a DCHECK later.
290 extensions::AppsClient::Get()->IncrementKeepAliveCount(); 290 extensions::AppWindowClient::Get()->IncrementKeepAliveCount();
291 291
292 Profile* current_profile = 292 Profile* current_profile =
293 profile_manager_->CreateTestingProfile("Test user"); 293 profile_manager_->CreateTestingProfile("Test user");
294 GURL url("chrome-extension://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); 294 GURL url("chrome-extension://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
295 extensions::AppWindow* window = new extensions::AppWindow( 295 extensions::AppWindow* window = new extensions::AppWindow(
296 current_profile, new ChromeAppDelegate(), extension.get()); 296 current_profile, new ChromeAppDelegate(), extension.get());
297 content::WebContents* web_contents( 297 content::WebContents* web_contents(
298 content::WebContents::Create(content::WebContents::CreateParams( 298 content::WebContents::Create(content::WebContents::CreateParams(
299 current_profile, 299 current_profile,
300 content::SiteInstance::CreateForURL(current_profile, url)))); 300 content::SiteInstance::CreateForURL(current_profile, url))));
(...skipping 11 matching lines...) Expand all
312 collector->UpdatePowerConsumptionForTesting(); 312 collector->UpdatePowerConsumptionForTesting();
313 EXPECT_EQ(1u, collector->metrics_map_for_testing()->size()); 313 EXPECT_EQ(1u, collector->metrics_map_for_testing()->size());
314 314
315 // Clear the AppWindowContents before trying to close. 315 // Clear the AppWindowContents before trying to close.
316 window->SetAppWindowContentsForTesting( 316 window->SetAppWindowContentsForTesting(
317 scoped_ptr<extensions::AppWindowContents>()); 317 scoped_ptr<extensions::AppWindowContents>());
318 window->OnNativeClose(); 318 window->OnNativeClose();
319 collector->UpdatePowerConsumptionForTesting(); 319 collector->UpdatePowerConsumptionForTesting();
320 EXPECT_EQ(0u, collector->metrics_map_for_testing()->size()); 320 EXPECT_EQ(0u, collector->metrics_map_for_testing()->size());
321 } 321 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698