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

Side by Side Diff: chrome/browser/protector/protector_service_browsertest.cc

Issue 10298012: [protector] Disable the UI by default, flip --no-protector to --protector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/protector/protector_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/command_line.h"
5 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
6 #include "base/message_loop.h" 7 #include "base/message_loop.h"
7 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/protector/mock_setting_change.h" 9 #include "chrome/browser/protector/mock_setting_change.h"
9 #include "chrome/browser/protector/protector_service.h" 10 #include "chrome/browser/protector/protector_service.h"
10 #include "chrome/browser/protector/protector_service_factory.h" 11 #include "chrome/browser/protector/protector_service_factory.h"
11 #include "chrome/browser/protector/settings_change_global_error.h" 12 #include "chrome/browser/protector/settings_change_global_error.h"
12 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/global_error.h" 14 #include "chrome/browser/ui/global_error.h"
14 #include "chrome/browser/ui/global_error_bubble_view_base.h" 15 #include "chrome/browser/ui/global_error_bubble_view_base.h"
15 #include "chrome/browser/ui/global_error_service.h" 16 #include "chrome/browser/ui/global_error_service.h"
16 #include "chrome/browser/ui/global_error_service_factory.h" 17 #include "chrome/browser/ui/global_error_service_factory.h"
18 #include "chrome/common/chrome_switches.h"
17 #include "chrome/test/base/in_process_browser_test.h" 19 #include "chrome/test/base/in_process_browser_test.h"
18 #include "chrome/test/base/ui_test_utils.h" 20 #include "chrome/test/base/ui_test_utils.h"
19 21
20 using ::testing::InvokeWithoutArgs; 22 using ::testing::InvokeWithoutArgs;
21 using ::testing::NiceMock; 23 using ::testing::NiceMock;
22 using ::testing::Return; 24 using ::testing::Return;
23 25
24 namespace protector { 26 namespace protector {
25 27
26 class ProtectorServiceTest : public InProcessBrowserTest { 28 class ProtectorServiceTest : public InProcessBrowserTest {
27 public: 29 public:
28 virtual void SetUpOnMainThread() { 30 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
31 // Make sure protector is enabled.
32 command_line->AppendSwitch(switches::kProtector);
33 }
34
35 virtual void SetUpOnMainThread() OVERRIDE {
29 protector_service_ = 36 protector_service_ =
30 ProtectorServiceFactory::GetForProfile(browser()->profile()); 37 ProtectorServiceFactory::GetForProfile(browser()->profile());
31 // ProtectService will own this change instance. 38 // ProtectService will own this change instance.
32 mock_change_ = new NiceMock<MockSettingChange>(); 39 mock_change_ = new NiceMock<MockSettingChange>();
33 } 40 }
34 41
35 protected: 42 protected:
36 GlobalError* GetGlobalError(BaseSettingChange* change) { 43 GlobalError* GetGlobalError(BaseSettingChange* change) {
37 for (ProtectorService::Items::iterator item = 44 for (ProtectorService::Items::iterator item =
38 protector_service_->items_.begin(); 45 protector_service_->items_.begin();
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 639
633 protector_service_->DismissChange(composite_change); 640 protector_service_->DismissChange(composite_change);
634 ui_test_utils::RunAllPendingInMessageLoop(); 641 ui_test_utils::RunAllPendingInMessageLoop();
635 EXPECT_FALSE(IsGlobalErrorActive(composite_change)); 642 EXPECT_FALSE(IsGlobalErrorActive(composite_change));
636 EXPECT_FALSE(protector_service_->GetLastChange()); 643 EXPECT_FALSE(protector_service_->GetLastChange());
637 } 644 }
638 645
639 // TODO(ivankr): Timeout test. 646 // TODO(ivankr): Timeout test.
640 647
641 } // namespace protector 648 } // namespace protector
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/protector/protector_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698