OLD | NEW |
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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/extensions/component_loader.h" | 8 #include "chrome/browser/extensions/component_loader.h" |
9 #include "chrome/browser/extensions/error_console/error_console.h" | 9 #include "chrome/browser/extensions/error_console/error_console.h" |
10 #include "chrome/browser/extensions/extension_browsertest.h" | 10 #include "chrome/browser/extensions/extension_browsertest.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 static const char* kHotwordHelperExtensionId = | 23 static const char* kHotwordHelperExtensionId = |
24 "dnhpdliibojhegemfjheidglijccjfmc"; | 24 "dnhpdliibojhegemfjheidglijccjfmc"; |
25 | 25 |
26 class HotwordBrowserTest : public ExtensionBrowserTest { | 26 class HotwordBrowserTest : public ExtensionBrowserTest { |
27 public: | 27 public: |
28 HotwordBrowserTest() : error_console_(NULL) { } | 28 HotwordBrowserTest() : error_console_(NULL) { } |
29 virtual ~HotwordBrowserTest() { } | 29 virtual ~HotwordBrowserTest() { } |
30 | 30 |
31 protected: | 31 protected: |
32 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 32 virtual void SetUpInProcessBrowserTestFixture() override { |
33 ExtensionBrowserTest::SetUpInProcessBrowserTestFixture(); | 33 ExtensionBrowserTest::SetUpInProcessBrowserTestFixture(); |
34 | 34 |
35 // Force the VoiceTrigger field trial on to enable the hotword_helper | 35 // Force the VoiceTrigger field trial on to enable the hotword_helper |
36 // extension. | 36 // extension. |
37 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 37 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
38 switches::kForceFieldTrials, "VoiceTrigger/Install/"); | 38 switches::kForceFieldTrials, "VoiceTrigger/Install/"); |
39 // Load the hotword_helper extension. | 39 // Load the hotword_helper extension. |
40 ComponentLoader::EnableBackgroundExtensionsForTesting(); | 40 ComponentLoader::EnableBackgroundExtensionsForTesting(); |
41 | 41 |
42 // We need to enable the ErrorConsole FeatureSwitch in order to collect | 42 // We need to enable the ErrorConsole FeatureSwitch in order to collect |
43 // errors. This should be enabled on any channel <= Dev, but let's make | 43 // errors. This should be enabled on any channel <= Dev, but let's make |
44 // sure (in case a test is running on, e.g., a beta channel). | 44 // sure (in case a test is running on, e.g., a beta channel). |
45 FeatureSwitch::error_console()->SetOverrideValue( | 45 FeatureSwitch::error_console()->SetOverrideValue( |
46 FeatureSwitch::OVERRIDE_ENABLED); | 46 FeatureSwitch::OVERRIDE_ENABLED); |
47 } | 47 } |
48 | 48 |
49 virtual void SetUpOnMainThread() OVERRIDE { | 49 virtual void SetUpOnMainThread() override { |
50 ExtensionBrowserTest::SetUpOnMainThread(); | 50 ExtensionBrowserTest::SetUpOnMainThread(); |
51 | 51 |
52 // Errors are only kept if we have Developer Mode enabled. | 52 // Errors are only kept if we have Developer Mode enabled. |
53 profile()->GetPrefs()->SetBoolean(prefs::kExtensionsUIDeveloperMode, true); | 53 profile()->GetPrefs()->SetBoolean(prefs::kExtensionsUIDeveloperMode, true); |
54 | 54 |
55 error_console_ = ErrorConsole::Get(profile()); | 55 error_console_ = ErrorConsole::Get(profile()); |
56 ASSERT_TRUE(error_console_); | 56 ASSERT_TRUE(error_console_); |
57 } | 57 } |
58 | 58 |
59 ErrorConsole* error_console() { return error_console_; } | 59 ErrorConsole* error_console() { return error_console_; } |
(...skipping 18 matching lines...) Expand all Loading... |
78 ASSERT_TRUE(extension); | 78 ASSERT_TRUE(extension); |
79 const Extension* test_extension = LoadExtension( | 79 const Extension* test_extension = LoadExtension( |
80 test_data_dir_.AppendASCII("hotword")); | 80 test_data_dir_.AppendASCII("hotword")); |
81 ASSERT_TRUE(test_extension); | 81 ASSERT_TRUE(test_extension); |
82 | 82 |
83 ASSERT_TRUE(doneListener.WaitUntilSatisfied()); | 83 ASSERT_TRUE(doneListener.WaitUntilSatisfied()); |
84 ASSERT_TRUE(error_console()->GetErrorsForExtension(extension->id()).empty()); | 84 ASSERT_TRUE(error_console()->GetErrorsForExtension(extension->id()).empty()); |
85 } | 85 } |
86 | 86 |
87 } // namespace extensions | 87 } // namespace extensions |
OLD | NEW |