summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/extensions/component_loader.h4
-rw-r--r--chrome/browser/speech/extension_api/tts_extension_apitest.cc22
2 files changed, 17 insertions, 9 deletions
diff --git a/chrome/browser/extensions/component_loader.h b/chrome/browser/extensions/component_loader.h
index 2f24323..38fbcb7 100644
--- a/chrome/browser/extensions/component_loader.h
+++ b/chrome/browser/extensions/component_loader.h
@@ -10,7 +10,6 @@
#include "base/callback_forward.h"
#include "base/files/file_path.h"
-#include "base/gtest_prod_util.h"
#include "base/memory/weak_ptr.h"
#include "base/values.h"
@@ -194,8 +193,7 @@ class ComponentLoader {
base::WeakPtrFactory<ComponentLoader> weak_factory_;
- FRIEND_TEST_ALL_PREFIXES(TtsApiTest, NetworkSpeechEngine);
- FRIEND_TEST_ALL_PREFIXES(TtsApiTest, NoNetworkSpeechEngineWhenOffline);
+ friend class TtsApiTest;
DISALLOW_COPY_AND_ASSIGN(ComponentLoader);
};
diff --git a/chrome/browser/speech/extension_api/tts_extension_apitest.cc b/chrome/browser/speech/extension_api/tts_extension_apitest.cc
index bd0adfc..5bd1316 100644
--- a/chrome/browser/speech/extension_api/tts_extension_apitest.cc
+++ b/chrome/browser/speech/extension_api/tts_extension_apitest.cc
@@ -17,6 +17,8 @@
#include "chrome/browser/speech/tts_controller.h"
#include "chrome/browser/speech/tts_platform.h"
#include "chrome/common/chrome_switches.h"
+#include "content/public/browser/notification_service.h"
+#include "content/public/test/test_utils.h"
#include "extensions/browser/extension_system.h"
#include "net/base/network_change_notifier.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -186,6 +188,18 @@ class TtsApiTest : public ExtensionApiTest {
TtsController::GetInstance()->SetPlatformImpl(&mock_platform_impl_);
}
+ void AddNetworkSpeechSynthesisExtension() {
+ content::WindowedNotificationObserver observer(
+ NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY,
+ content::NotificationService::AllSources());
+ ExtensionService* service =
+ extensions::ExtensionSystem::Get(profile())->extension_service();
+ service->component_loader()->AddNetworkSpeechSynthesisExtension();
+ observer.Wait();
+ ASSERT_EQ(Manifest::COMPONENT,
+ content::Source<const Extension>(observer.source())->location());
+ }
+
protected:
StrictMock<MockTtsPlatformImpl> mock_platform_impl_;
};
@@ -427,9 +441,7 @@ IN_PROC_BROWSER_TEST_F(TtsApiTest, NetworkSpeechEngine) {
net::NetworkChangeNotifier::DisableForTest disable_for_test;
FakeNetworkOnlineStateForTest fake_online_state(true);
- ExtensionService* service = extensions::ExtensionSystem::Get(
- profile())->extension_service();
- service->component_loader()->AddNetworkSpeechSynthesisExtension();
+ ASSERT_NO_FATAL_FAILURE(AddNetworkSpeechSynthesisExtension());
ASSERT_TRUE(RunExtensionTest("tts_engine/network_speech_engine")) << message_;
}
@@ -438,9 +450,7 @@ IN_PROC_BROWSER_TEST_F(TtsApiTest, NoNetworkSpeechEngineWhenOffline) {
net::NetworkChangeNotifier::DisableForTest disable_for_test;
FakeNetworkOnlineStateForTest fake_online_state(false);
- ExtensionService* service = extensions::ExtensionSystem::Get(
- profile())->extension_service();
- service->component_loader()->AddNetworkSpeechSynthesisExtension();
+ ASSERT_NO_FATAL_FAILURE(AddNetworkSpeechSynthesisExtension());
// Test should fail when offline.
ASSERT_FALSE(RunExtensionTest("tts_engine/network_speech_engine"));
}