Home | History | Annotate | Download | only in drive
      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
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
      6 
      7 #include "base/prefs/pref_service.h"
      8 #include "chrome/browser/profiles/profile.h"
      9 #include "chrome/browser/ui/browser.h"
     10 #include "chrome/common/pref_names.h"
     11 #include "chrome/test/base/in_process_browser_test.h"
     12 
     13 namespace drive {
     14 
     15 class DriveIntegrationServiceBrowserTest : public InProcessBrowserTest {
     16 };
     17 
     18 // Verify DriveIntegrationService is created during login.
     19 IN_PROC_BROWSER_TEST_F(DriveIntegrationServiceBrowserTest,
     20                        CreatedDuringLogin) {
     21   EXPECT_TRUE(DriveIntegrationServiceFactory::FindForProfile(
     22       browser()->profile()));
     23 }
     24 
     25 
     26 IN_PROC_BROWSER_TEST_F(DriveIntegrationServiceBrowserTest,
     27                        DisableDrivePolicyTest) {
     28   // First make sure the pref is set to its default value which should permit
     29   // drive.
     30   browser()->profile()->GetPrefs()->SetBoolean(prefs::kDisableDrive, false);
     31 
     32   drive::DriveIntegrationService* integration_service =
     33       drive::DriveIntegrationServiceFactory::GetForProfile(
     34           browser()->profile());
     35 
     36   EXPECT_TRUE(integration_service);
     37 
     38   // ...next try to disable drive.
     39   browser()->profile()->GetPrefs()->SetBoolean(prefs::kDisableDrive, true);
     40 
     41   integration_service =
     42       drive::DriveIntegrationServiceFactory::GetForProfile(
     43           browser()->profile());
     44 
     45   EXPECT_FALSE(integration_service);
     46 }
     47 
     48 }  // namespace drive
     49