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

Side by Side Diff: chrome/browser/ui/panels/base_panel_browser_test.cc

Issue 10987037: Add tests for panel app icon functionaility. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch Created 8 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/panels/base_panel_browser_test.h" 5 #include "chrome/browser/ui/panels/base_panel_browser_test.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/json/json_file_value_serializer.h"
9 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
10 #include "base/message_loop.h" 11 #include "base/message_loop.h"
11 #include "base/path_service.h" 12 #include "base/path_service.h"
12 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
13 #include "chrome/browser/extensions/extension_service.h" 14 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/panels/native_panel.h" 17 #include "chrome/browser/ui/panels/native_panel.h"
17 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" 18 #include "chrome/browser/ui/panels/panel_mouse_watcher.h"
18 #include "chrome/browser/ui/panels/panel_strip.h" 19 #include "chrome/browser/ui/panels/panel_strip.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 full_path, location, *input_value, Extension::NO_FLAGS, &error); 418 full_path, location, *input_value, Extension::NO_FLAGS, &error);
418 EXPECT_TRUE(extension.get()); 419 EXPECT_TRUE(extension.get());
419 EXPECT_STREQ("", error.c_str()); 420 EXPECT_STREQ("", error.c_str());
420 browser()->profile()->GetExtensionService()-> 421 browser()->profile()->GetExtensionService()->
421 OnExtensionInstalled(extension.get(), false /* not from webstore */, 422 OnExtensionInstalled(extension.get(), false /* not from webstore */,
422 syncer::StringOrdinal(), 423 syncer::StringOrdinal(),
423 false /* no requirement errors */); 424 false /* no requirement errors */);
424 return extension; 425 return extension;
425 } 426 }
426 427
428 scoped_refptr<extensions::Extension>
429 BasePanelBrowserTest::LoadExtensionFromManifest(
dcheng 2012/09/25 21:50:27 Is it possible to share this code with ExtensionBr
jianli 2012/09/25 22:50:04 Will change BasePanelBrowserTest to inherit from E
430 const FilePath::StringType& manifest_file) {
431 FilePath manifest_path;
432 PathService::Get(chrome::DIR_TEST_DATA, &manifest_path);
433 manifest_path = manifest_path.Append(kTestDir);
434 manifest_path = manifest_path.Append(manifest_file);
435
436 JSONFileValueSerializer serializer(manifest_path);
437 scoped_ptr<DictionaryValue> manifest(
438 static_cast<DictionaryValue*>(serializer.Deserialize(NULL, NULL)));
439 EXPECT_TRUE(manifest.get() != NULL);
440
441 std::string error;
442 scoped_refptr<extensions::Extension> extension(Extension::Create(
443 manifest_path.DirName(), Extension::INVALID, *manifest.get(),
444 Extension::NO_FLAGS, &error));
445 EXPECT_TRUE(extension.get());
446 EXPECT_STREQ("", error.c_str());
447 browser()->profile()->GetExtensionService()->
448 OnExtensionInstalled(extension.get(), false /* not from webstore */,
449 syncer::StringOrdinal(),
450 false /* no requirement errors */);
451 return extension;
452 }
453
427 void BasePanelBrowserTest::SetTestingAreas(const gfx::Rect& primary_screen_area, 454 void BasePanelBrowserTest::SetTestingAreas(const gfx::Rect& primary_screen_area,
428 const gfx::Rect& work_area) { 455 const gfx::Rect& work_area) {
429 DCHECK(primary_screen_area.Contains(work_area)); 456 DCHECK(primary_screen_area.Contains(work_area));
430 mock_display_settings_provider_->SetPrimaryScreenArea(primary_screen_area); 457 mock_display_settings_provider_->SetPrimaryScreenArea(primary_screen_area);
431 mock_display_settings_provider_->SetWorkArea( 458 mock_display_settings_provider_->SetWorkArea(
432 work_area.IsEmpty() ? primary_screen_area : work_area); 459 work_area.IsEmpty() ? primary_screen_area : work_area);
433 } 460 }
434 461
435 void BasePanelBrowserTest::CloseWindowAndWait(Panel* panel) { 462 void BasePanelBrowserTest::CloseWindowAndWait(Panel* panel) {
436 // Closing a panel may involve several async tasks. Need to use 463 // Closing a panel may involve several async tasks. Need to use
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 } 495 }
469 496
470 void BasePanelBrowserTest::MoveMouse(const gfx::Point& position) { 497 void BasePanelBrowserTest::MoveMouse(const gfx::Point& position) {
471 PanelManager::GetInstance()->mouse_watcher()->NotifyMouseMovement(position); 498 PanelManager::GetInstance()->mouse_watcher()->NotifyMouseMovement(position);
472 } 499 }
473 500
474 std::string BasePanelBrowserTest::MakePanelName(int index) { 501 std::string BasePanelBrowserTest::MakePanelName(int index) {
475 std::string panel_name("Panel"); 502 std::string panel_name("Panel");
476 return panel_name + base::IntToString(index); 503 return panel_name + base::IntToString(index);
477 } 504 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698