tests/ceftests/preference_unittest.cc
// Verify setting/getting preference values on shared custom contexts.
Verify setting/getting preference values on shared custom contexts.
Verify setting / getting preference values on shared custom contexts .
TEST(PreferenceTest, CustomSetGetShared) {
  CefRefPtr<CefWaitableEvent> event =
      CefWaitableEvent::CreateWaitableEvent(true, false);
  CefRequestContextSettings settings;
  CefRefPtr<CefRequestContext> context = CefRequestContext::CreateContext(
      settings, new TestRequestContextHandler(event));
  EXPECT_TRUE(context.get());
  event->Wait();
  CefRefPtr<CefRequestContext> context2 =
      CefRequestContext::CreateContext(context, nullptr);
  EXPECT_TRUE(context2.get());
  CefRefPtr<CefRequestContext> context3 =
      CefRequestContext::CreateContext(context, new TestRequestContextHandler);
  EXPECT_TRUE(context3.get());
  CefRefPtr<CefRequestContext> context4 = CefRequestContext::CreateContext(
      settings, new TestRequestContextHandler(event));
  EXPECT_TRUE(context4.get());
  event->Wait();
  *PendingAction() = "Set/get the values on the first context";
  ValidateSetGet(context, event);
  event->Wait();
  *PendingAction() = "Get the values from the 2nd context.";
  ValidateGet(context2, event);
  event->Wait();
  *PendingAction() = "Get the values from the 3rd context.";
  ValidateGet(context3, event);
  event->Wait();
  *PendingAction() = "Get the values from the 4th context.";
  ValidateDefaults(context4, false, event);
  event->Wait();
  *PendingAction() = "Reset to the default values.";
  ValidateDefaults(context, true, event);
  event->Wait();
}
TEST ( PreferenceTest , CustomSetGetShared ) { CefRefPtr < CefWaitableEvent > event = CefWaitableEvent :: CreateWaitableEvent ( true , false ) ; CefRequestContextSettings settings ; CefRefPtr < CefRequestContext > context = CefRequestContext :: CreateContext ( settings , new TestRequestContextHandler ( event ) ) ; EXPECT_TRUE ( context . get ( ) ) ; event -> Wait ( ) ; CefRefPtr < CefRequestContext > context2 = CefRequestContext :: CreateContext ( context , nullptr ) ; EXPECT_TRUE ( context2 . get ( ) ) ; CefRefPtr < CefRequestContext > context3 = CefRequestContext :: CreateContext ( context , new TestRequestContextHandler ) ; EXPECT_TRUE ( context3 . get ( ) ) ; CefRefPtr < CefRequestContext > context4 = CefRequestContext :: CreateContext ( settings , new TestRequestContextHandler ( event ) ) ; EXPECT_TRUE ( context4 . get ( ) ) ; event -> Wait ( ) ; * PendingAction ( ) = " " ; ValidateSetGet ( context , event ) ; event -> Wait ( ) ; * PendingAction ( ) = " " ; ValidateGet ( context2 , event ) ; event -> Wait ( ) ; * PendingAction ( ) = " " ; ValidateGet ( context3 , event ) ; event -> Wait ( ) ; * PendingAction ( ) = " " ; ValidateDefaults ( context4 , false , event ) ; event -> Wait ( ) ; * PendingAction ( ) = " " ; ValidateDefaults ( context , true , event ) ; event -> Wait ( ) ; }
Verify setting/getting preference values on shared custom contexts.
Verify setting / getting preference values on shared custom contexts .
// Wait for the context to be fully initialized. // Sharing storage. // Sharing storage. // Unassociated context. // Wait for the context to be fully initialized. // Set/get the values on the first context. // Get the values from the 2nd and 3d contexts. They should be the same. // Get the values from the 4th context. They should be at the default. // This works with the Chrome runtime because the preference changes only // exist in the other incognito profile's overlay. // Reset to the default values.