| 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/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
| 7 #include "chrome/browser/extensions/component_loader.h" | 7 #include "chrome/browser/extensions/component_loader.h" |
| 8 #include "chrome/browser/extensions/error_console/error_console.h" | 8 #include "chrome/browser/extensions/error_console/error_console.h" |
| 9 #include "chrome/browser/extensions/extension_browsertest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 ~HotwordBrowserTest() override {} | 28 ~HotwordBrowserTest() override {} |
| 29 | 29 |
| 30 protected: | 30 protected: |
| 31 void SetUpInProcessBrowserTestFixture() override { | 31 void SetUpInProcessBrowserTestFixture() override { |
| 32 ExtensionBrowserTest::SetUpInProcessBrowserTestFixture(); | 32 ExtensionBrowserTest::SetUpInProcessBrowserTestFixture(); |
| 33 | 33 |
| 34 // Force the VoiceTrigger field trial on to enable the hotword_helper | 34 // Force the VoiceTrigger field trial on to enable the hotword_helper |
| 35 // extension. | 35 // extension. |
| 36 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 36 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 37 switches::kForceFieldTrials, "VoiceTrigger/Install/"); | 37 switches::kForceFieldTrials, "VoiceTrigger/Install/"); |
| 38 // This test is only valid with version 1 of hotwording. | |
| 39 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 40 switches::kDisableExperimentalHotwording); | |
| 41 // Load the hotword_helper extension. | 38 // Load the hotword_helper extension. |
| 42 ComponentLoader::EnableBackgroundExtensionsForTesting(); | 39 ComponentLoader::EnableBackgroundExtensionsForTesting(); |
| 43 | 40 |
| 44 // We need to enable the ErrorConsole FeatureSwitch in order to collect | 41 // We need to enable the ErrorConsole FeatureSwitch in order to collect |
| 45 // errors. This should be enabled on any channel <= Dev, but let's make | 42 // errors. This should be enabled on any channel <= Dev, but let's make |
| 46 // sure (in case a test is running on, e.g., a beta channel). | 43 // sure (in case a test is running on, e.g., a beta channel). |
| 47 FeatureSwitch::error_console()->SetOverrideValue( | 44 FeatureSwitch::error_console()->SetOverrideValue( |
| 48 FeatureSwitch::OVERRIDE_ENABLED); | 45 FeatureSwitch::OVERRIDE_ENABLED); |
| 49 } | 46 } |
| 50 | 47 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 63 private: | 60 private: |
| 64 // Weak reference to the ErrorConsole. | 61 // Weak reference to the ErrorConsole. |
| 65 ErrorConsole* error_console_; | 62 ErrorConsole* error_console_; |
| 66 | 63 |
| 67 DISALLOW_COPY_AND_ASSIGN(HotwordBrowserTest); | 64 DISALLOW_COPY_AND_ASSIGN(HotwordBrowserTest); |
| 68 }; | 65 }; |
| 69 | 66 |
| 70 // Test we silently capture an exception from a message handler's response | 67 // Test we silently capture an exception from a message handler's response |
| 71 // callback. This happens when the caller to chrome.runtime.sendMessage() | 68 // callback. This happens when the caller to chrome.runtime.sendMessage() |
| 72 // doesn't specify a response callback. | 69 // doesn't specify a response callback. |
| 73 IN_PROC_BROWSER_TEST_F(HotwordBrowserTest, MessageSendResponseError) { | 70 // NOTE(amistry): Test is disabled instead of deleted since the functionality |
| 71 // may still be required to implement crbug.com/436681 |
| 72 IN_PROC_BROWSER_TEST_F(HotwordBrowserTest, DISABLED_MessageSendResponseError) { |
| 74 // Enable error reporting for the hotword helper extension. | 73 // Enable error reporting for the hotword helper extension. |
| 75 error_console()->SetReportingAllForExtension(kHotwordHelperExtensionId, true); | 74 error_console()->SetReportingAllForExtension(kHotwordHelperExtensionId, true); |
| 76 | 75 |
| 77 ExtensionTestMessageListener doneListener("done", false); | 76 ExtensionTestMessageListener doneListener("done", false); |
| 78 const Extension* extension = extension_service()->GetExtensionById( | 77 const Extension* extension = extension_service()->GetExtensionById( |
| 79 kHotwordHelperExtensionId, false); | 78 kHotwordHelperExtensionId, false); |
| 80 ASSERT_TRUE(extension); | 79 ASSERT_TRUE(extension); |
| 81 const Extension* test_extension = LoadExtension( | 80 const Extension* test_extension = LoadExtension( |
| 82 test_data_dir_.AppendASCII("hotword")); | 81 test_data_dir_.AppendASCII("hotword")); |
| 83 ASSERT_TRUE(test_extension); | 82 ASSERT_TRUE(test_extension); |
| 84 | 83 |
| 85 ASSERT_TRUE(doneListener.WaitUntilSatisfied()); | 84 ASSERT_TRUE(doneListener.WaitUntilSatisfied()); |
| 86 ASSERT_TRUE(error_console()->GetErrorsForExtension(extension->id()).empty()); | 85 ASSERT_TRUE(error_console()->GetErrorsForExtension(extension->id()).empty()); |
| 87 } | 86 } |
| 88 | 87 |
| 89 } // namespace extensions | 88 } // namespace extensions |
| OLD | NEW |